This file contains hidden or 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 MogileFS::Client; | |
use MIME::Types; | |
my $mogc = MogileFS::Client->new( | |
domain => ($ENV{DOMAIN} || 'yapc2009'), | |
hosts => ['127.0.0.1:7001'], | |
) or die "Could not initialize MogileFS"; | |
use Plack::Request; |
This file contains hidden or 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 LWP::UserAgent::ProxyConnect; | |
use strict; | |
use warnings; | |
our $VERSION = '0.01'; | |
use LWP::UserAgent (); | |
{ | |
use LWP::Protocol::http (); |
This file contains hidden or 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/perl | |
use strict; | |
use warnings; | |
use Test::More; | |
BEGIN { | |
my @table = (0 .. 9, 'A' .. 'Z', 'a' .. 'z', '_', '-'); | |
use constant NUM64 => \@table; | |
use constant DIGIT => 6; |
This file contains hidden or 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
function cpan-uninstall { | |
perl -MConfig -MExtUtils::Install -le ' | |
($FULLEXT = shift) =~ s{::}{/}g; | |
if ($_ = $ENV{PERL_MM_OPT}) { | |
s/INSTALL_BASE=//; | |
$_ .= "/lib/perl5/$Config{archname}/auto/$FULLEXT/.packlist"; | |
} | |
else { | |
$_ = "$Config{sitearchexp}/auto/$FULLEXT/.packlist"; | |
} |
This file contains hidden or 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/perl | |
package string; | |
use overload '""' => sub { ${$_[0]} }; | |
sub __ : method : lvalue { substr(${$_[0]}, $_[1], $_[2]) } | |
package main; | |
use Data::Dump qw/dump/; | |
sub p { print dump(@_), "\n" } | |
sub _ { local $_ = $_[0]; bless \$_, 'string' } | |
This file contains hidden or 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
<?php | |
$connect_info = file_get_contents('connect_info.json'); | |
$connect_info = json_decode($connect_info, true); | |
foreach (explode(";", $connect_info["dsn"]) as $line) { | |
list($key, $value) = explode("=", $line); | |
$connect_info[$key] = $value; | |
} |
This file contains hidden or 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 Data::Dumper; | |
sub foo { | |
my ( $a_ref, $key, $value ) = @_; | |
eval join('->', '$a_ref', map "{$_}", split /\./, $key) . ' = $value'; | |
return $a_ref; | |
} | |
my $ref = { |
This file contains hidden or 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/perl | |
use strict; | |
use warnings; | |
sub hanoi { | |
my ($from, $to, $spare, $num) = @_; | |
my $hanoi = $num > 1 ? \&hanoi : sub {}; | |
$hanoi->($from, $spare, $to, $num - 1); |
This file contains hidden or 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/perl -l | |
use strict; | |
use Time::HiRes; | |
my $start_time = Time::HiRes::time; | |
main(int($ARGV[0]) || 10_000); | |
my $end_time = Time::HiRes::time; | |
my $computation_time = $end_time - $start_time; |