This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env perl | |
use strict; | |
use warnings; | |
use utf8; | |
use URI; | |
use LWP::Simple (); | |
use XML::Simple; | |
use Web::Scraper; | |
use Encode qw/ encode_utf8 /; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use Benchmark qw(cmpthese timethese); | |
cmpthese(timethese(1_000_000, { | |
's///' => sub { | |
my $str = q!1qaz2wsx(3edc4rfv5tgb)6yhn7ujm!; | |
my $del = q!4rfv5tgb)6yhn!; | |
$del =~ s/([\(\)])/\\$1/g; | |
$str =~ s/$del//; | |
}, | |
'quotemeta' => sub { | |
my $str = q!1qaz2wsx(3edc4rfv5tgb)6yhn7ujm!; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package class; | |
use strict; | |
use warnings; | |
sub import { | |
no strict 'refs'; | |
my $class = caller; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env perl | |
use File::Spec; | |
my $pg = shift(@ARGV); | |
for my $path (split /:/, $ENV{PATH}) { | |
if (-x File::Spec->catfile($path, $pg)) { | |
print File::Spec->catfile($path, $pg), "\n"; | |
last; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env perl | |
use strict; | |
use warnings; | |
use utf8; | |
use Encode qw/ encode_utf8 /; | |
use Time::HiRes qw/ sleep /; | |
$| = 1; | |
sub nagato { | |
my $str = shift; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package Class::Unload::All; | |
use strict; | |
use warnings; | |
use B::Hooks::EndOfScope qw/ on_scope_end /; | |
use Class::Unload; | |
use Module::Used qw/ modules_used_in_files /; | |
sub import { | |
my $class = caller; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env perl | |
use strict; | |
use warnings; | |
use PDF::API2; | |
for my $file (@ARGV) { | |
print "$file page rotation.¥n"; | |
my $pdf = PDF::API2->open($file); | |
for my $page_number (1..$pdf->pages) { | |
$pdf->openpage($page_number) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use strict; | |
use utf8; | |
use File::Spec; | |
use File::Basename; | |
use lib File::Spec->catdir(dirname(__FILE__), 'extlib', 'lib', 'perl5'); | |
use lib File::Spec->catdir(dirname(__FILE__), 'lib'); | |
use Plack::Builder; | |
use T::Web; | |
use T; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ cat qr_speed.pl | |
use strict; | |
use Benchmark qw/ cmpthese /; | |
my $re_string = 'a.c'; | |
my $re_regexp = qr/a.c/; | |
sub match { | |
my $re = shift; | |
"abc" =~ /$re/; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ cat qr_speed.pl | |
use strict; | |
use Benchmark qw/ cmpthese /; | |
my $re_string = 'a.c'; | |
my $re_regexp = qr/a.c/; | |
sub match { | |
my $re = shift; | |
"abc" =~ /$re/; |
OlderNewer