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 Hitagi; | |
use File::Temp qw/ tempfile /; | |
use IO::File::WithPath; | |
my ($client) = grep { -e $_ } qw( | |
/Applications/Emacs.app/Contents/MacOS/bin/emacsclient | |
/usr/bin/emacsclient.emacs-snapshot | |
); |
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/perl | |
use strict; | |
use warnings; | |
use LWP::UserAgent; | |
use HTTP::Request::Common; | |
use Path::Class qw/ file /; | |
use Try::Tiny; | |
my $host = "fujiwara-mac"; | |
my $port = 9292; | |
my $file = 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
#!/usr/bin/env perl | |
use feature ":5.10"; | |
use strict; | |
use utf8; | |
use Tatsumaki::Error; | |
use Tatsumaki::Application; | |
use Tatsumaki::HTTPClient; | |
use Tatsumaki::Server; | |
use Tatsumaki::MessageQueue; |
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 { | |
my $env = shift; # request | |
# ... | |
return [ # response | |
200, # status code | |
[ "Content-Type" => "text/plain" ], # headers | |
["Hello world"] # body | |
]; | |
} |
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 { | |
my $env = shift; # request | |
# ... | |
return [ # response | |
200, # status code | |
[ "Content-Type" => "text/plain" ], # headers | |
["Hello world"] # body | |
]; | |
} |
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 ImageResize; | |
use strict; | |
use warnings; | |
use nginx; | |
use Image::Imlib2; | |
Image::Imlib2->set_cache_size(0); | |
sub handler { | |
my $r = shift; | |
my ($file) = split /\?/, $r->uri; |
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 Web::Scraper; | |
use LWP::UserAgent; | |
use Encode; | |
my $s = scraper { process "#topicsfb li" => "topics[]" => "TEXT" }; | |
$s->user_agent( LWP::UserAgent->new( agent => "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; Trident/4.0)" ) ); | |
my $r = $s->scrape( URI->new("http://www.yahoo.co.jp") ); | |
print encode_utf8($_), "\n" for @{ $r->{topics} }; |
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 Benchmark qw/cmpthese/; | |
cmpthese( 0, { | |
'core' => \&core_reverse, | |
'push_pop' => \&push_pop_style, | |
'slice' => \&slice, | |
}); | |
sub core_reverse { |
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
[fujiwara@hostname]$ /usr/local/perl-5.8.3/bin/perl Makefile.PL | |
Writing ppport.h | |
Writing Makefile for Text::Xslate | |
[fujiwara@hostname]$ make | |
cp lib/Text/Xslate/PP/EscapedString.pm blib/lib/Text/Xslate/PP/EscapedString.pm | |
cp lib/Text/Xslate/PP/Const.pm blib/lib/Text/Xslate/PP/Const.pm | |
cp lib/Text/Xslate/PP/Booster.pm blib/lib/Text/Xslate/PP/Booster.pm | |
cp lib/Text/Xslate/PP/Type/Hash.pm blib/lib/Text/Xslate/PP/Type/Hash.pm | |
cp lib/Text/Xslate.pm blib/lib/Text/Xslate.pm | |
cp lib/Text/Xslate/EscapedString.pm blib/lib/Text/Xslate/EscapedString.pm |
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
0.1031 | |
Benchmark: running tx for at least 3 CPU seconds... | |
tx: 4 wallclock secs ( 2.90 usr + 0.27 sys = 3.17 CPU) @ 28618.30/s (n=90720) | |
0.1032 | |
Benchmark: running tx for at least 3 CPU seconds... | |
tx: 4 wallclock secs ( 2.80 usr + 0.36 sys = 3.16 CPU) @ 3044.62/s (n=9621) | |
0.1033 | |
Benchmark: running tx for at least 3 CPU seconds... | |
tx: 3 wallclock secs ( 2.85 usr + 0.35 sys = 3.20 CPU) @ 3010.00/s (n=9632) |