Skip to content

Instantly share code, notes, and snippets.

@sng2c
sng2c / using_PAR.mkd
Last active December 16, 2015 17:09
원격으로 PAR을 실행하는 세가지 방법

원격으로 PAR을 실행하는 세가지 방법

# Test1.pm
package Test1;
hello{
    print "HELLO\n";
}

1. PAR Repository 이용.

@sng2c
sng2c / gist:5468028
Created April 26, 2013 15:15
워드프레스에 소스넣기
[sourcecode language="perl"]
use 5.010;
say "hello";
[/sourcecode]
@sng2c
sng2c / makedic.pl
Created April 19, 2013 14:49
사전코딩. 참고 : http://altools.tistory.com/60
#!/usr/bin/env perl
use strict;
use warnings;
use utf8;
use 5.010;
use YAML;
=pod
@sng2c
sng2c / index_arr.pl
Last active December 15, 2015 05:48
perl에서 index() 와 같이 작동하지만 인자는 배열인 거. https://gist.github.com/am0c/dc65b37eca606e74e760 에 offset 추가
sub index_array {
my ($array, $key, $offset) = @_;
my $i = 0;
for my $i ($offset .. $#$array) {
my $is_eql = 1;
for my $j (0 .. $#$key) {
last if $i + $j > $#$array;
if ($key->[$j] ne $array->[$i + $j]) {
@sng2c
sng2c / buscheck.pl
Created September 25, 2012 07:29
고속버스 빈자리 체크
#!/usr/bin/perl
use utf8;
use LWP::UserAgent;
use Encode;
use AnyEvent;
binmode(STDOUT,":utf8");
my $cv = AE::cv;
my $only_biz = 1;
@sng2c
sng2c / ev3.pl
Created June 21, 2012 09:04
coupled timer fail
use AnyEvent;
use EV;
my $cv = AE::cv;
my $t = AE::timer 2,0, sub{
my $cv2 = AE::cv;
my $cnt = 10;
my $tot = 0;
@sng2c
sng2c / ev2.pl
Created June 21, 2012 08:27
solve local blocking
use AnyEvent;
my $cv = AE::cv;
my $t = AE::timer 2,0, sub{
my $cv2 = AE::cv;
my $cnt = 10;
@sng2c
sng2c / evtest.pl
Created June 21, 2012 07:53
AnyEvent recursive blocking wait error
use AnyEvent;
my $cv = AE::cv;
my $t = AE::timer 2,0, sub{
my $cv2 = AE::cv;
my $cnt = 10;
my $tot = 0;
foreach(1..10){
@sng2c
sng2c / depend.sh
Created June 14, 2012 08:09
perl dependency checker for cpanm by ack
ack --perl --no-group --no-filename '^(use |requires [\x{27}"])' */Makefile.PL */lib/ */bin/ */examples/ */t/ | sort | uniq
@sng2c
sng2c / depend.pl
Created June 14, 2012 07:20
module dependency checker for cpanm
#!/usr/bin/perl
use strict;
use File::Find;
use Module::Which;
use Module::ExtractUse;
my %depend;
finddepth({wanted=>\&wanted,follow_fast=>1} ,@ARGV);
print join "\n",keys %depend;