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 5.12.1; | |
use common::sense; | |
use Path::Class qw(file); | |
use File::Spec; | |
use File::Basename; | |
my $dir = File::Spec->rel2abs(dirname(__FILE__)); | |
my @files; | |
if(@ARGV){ |
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 common::sense; | |
use Benchmark qw(timethese cmpthese); | |
use Compress::LZO; | |
use Compress::Zlib; | |
my $data = 'data' x 1000; | |
cmpthese timethese(500000, +{ | |
lzo => sub{ | |
my $comp = Compress::LZO::compress($data); |
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
sub array_dumper(@){ | |
my @array = @_; | |
my $str = '['; | |
if(@array){ | |
foreach my $p (@array){ | |
if(defined $p){ | |
if(ref($p)){ | |
if(ref($p) eq 'ARRAY'){ | |
$str .= array_dumper(@$p) . ', '; |
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 Exporter::All; | |
use strict; | |
use warnings; | |
sub import { | |
my $class = shift; | |
my $caller = caller; | |
{ | |
no strict 'refs'; |
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 feature qw/say/; | |
my $char = qr{[^\|\+\*\(\)\[\}\\]|(?:\\[\|\+\*\(\)\[\}\\])}; | |
my $str = qr{(?:${char}(?:[\+\*\?][^\+\*\?]?)?)+}; | |
my $char_set = qr{\[${char}+\]}; | |
my $regexp = qr{(?:(?:\(\R(?:\|\R)*\))|(?:\R(?:\|\R)*)|(?:${str}|${char_set})+)*}; |
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 warnings; | |
use Data::Dumper; | |
use Class::Load; | |
my $wantclass = shift(@ARGV) or die; | |
Class::Load::load_class($wantclass); | |
print Dumper[grep { /^dispatch_/ } get_all_methods($wantclass)]; |
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
sub get_all_isa($) { ## no critic | |
_get_all_isa(shift, +{}); | |
} | |
sub _get_all_isa { | |
my($class, $searched_hash) = @_; | |
my @class_isa = do { | |
no strict 'refs'; | |
grep { not exists $searched_hash->{$_} } @{"${class}::ISA"}; |
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 Tokyo; | |
package Chiba; | |
package main; | |
use strict; | |
use warnings; | |
use Benchmark qw/cmpthese timethese/; | |
my $table = +{ |
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 DBIx::Skinny::Utils::CondMerge; | |
use strict; | |
use warnings; | |
use Hash::Merge; | |
our @EXPORT_OK = qw/skinny_cond_merge/; | |
use Exporter::Lite; | |
### XXX: 全てのケースを試したわけではないのでバグあるかも |
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 common::sense; | |
use Benchmark qw(timethese cmpthese); | |
use List::Util qw/max/; | |
use Compress::LZO (); | |
use Compress::LZF (); | |
use Compress::LZW (); | |
use Compress::Zlib (); | |
use Compress::Snappy (); | |
my $data = 'data' x 10000; |
OlderNewer