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
my $header; | |
my $buf; | |
my $term = "\n\n"; | |
my $term_buf = ''; | |
open($fh, $path) || die "$path $!"; | |
while (read($fh, $buf, 4096)) { | |
$buf=~tr/\r//; | |
my $pos = index($term_buf . $buf, $term); | |
if ($pos >= 0) { | |
my $pos2 = $pos - length($term_buf); |
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 MasterSpark::Web::Dispatcher; | |
use strict; | |
use warnings; | |
use Amon2::Web::Dispatcher::RouterSimple; | |
connect '/{action}' => { controller => 'Root' }; | |
connect '/{controller}/{action}' => {}, { | |
on_match => sub { |
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 lib qw(lib); | |
use Plack::Request; | |
use Plack::Builder; | |
use Plack::Session::Store::File; | |
use Plack::Session::State::Cookie; | |
use String::Urandom; | |
my $secure = 1; # use SSL | |
my $httponly = 1; # only HTTP |
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 Data::Section::Simple; | |
use Encode; | |
use JSON; | |
use Path::Class; | |
use Plack::Builder; | |
use Plack::Request; | |
use Text::Markdown; | |
use Text::Xslate; |
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 Hamburger::Model; | |
use parent 'Teng'; | |
use DateTime; | |
sub dbh { | |
my $self = shift; | |
$self->SUPER::dbh; | |
$self->connect unless $self->{dbh}; | |
$self->{dbh}; |
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 WebService::Simple; | |
print WebService::Simple->new( | |
base_url => 'http://urls.api.twitter.com/1/urls/count.json', | |
response_parser => 'JSON' | |
)->get( { url => shift } )->parse_response->{count}, "\n"; |
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
find lib -type f | sed -e 's|^lib/||g; s|\.pm$||g; s|/|::|g' > modules.lst | |
perl -I lib -Mlib::xi -e 'eval "use $_";die $@ if $@' -n modules.lst |
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 MIME::Base64; | |
my $base64 = encode_base64(join('', <>)); | |
$base64=~s|\s*||g; | |
print $base64, "\n"; | |
# base64 |
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
echo .foo | perl -ne 'chomp;print "^", quotemeta($_), "\$\n"' >> MANIFEST.SKIP |
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 | |
# get screenshot | |
# screenshot.pl URL filename | |
# | |
# ubuntu | |
# sudo apt-get install xvfb chromium-browser imagemagick | |
# | |
# Japanese Font | |
# sudo apt-get install ttf-takao |
OlderNewer