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 5.12.0; | |
use warnings; | |
use utf8; | |
use POSIX ':sys_wait_h'; | |
my $pid = fork(); | |
if ( $pid ) { | |
# parent | |
say "parent-start child_pid: $pid"; | |
sleep 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
use strict; | |
use warnings; | |
my $app = sub { | |
my $env = shift; | |
return sub { | |
my $responder = shift; | |
my $writer = $responder->([ 200, []]); |
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 SQL::Maker::Select::Joinful; | |
use strict; | |
use warnings; | |
use utf8; | |
use base 'SQL::Maker::Select'; | |
sub add_join { | |
my ($self, $joins) = @_; |
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 DBI; | |
use Data::Dumper; | |
my $dbh = DBI->connect('dbi:mysql:database=sandbox', 'sandbox', 'sandbox'); | |
$dbh = $dbh->clone(); | |
warn Dumper($dbh); | |
$dbh = $dbh->clone(); |
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 Benchmark qw/cmpthese/; | |
my $hash = +{ | |
id => 123, | |
mail => '[email protected]', |
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/env perl | |
use strict; | |
use warnings; | |
use DBI; | |
use Test::More; | |
my $CONNECT_INFO = { | |
dsn => 'dbi:mysql:database=dbibench;host=localhost;mysql_server_prepare=1', | |
username => 'guest', | |
password => 'guest', | |
connect_options => { |
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
- app.psgi | |
sub { | |
return ['200', ['content-type' => 'text/html', 'content-length' => 11], ['hello world']]; | |
} | |
ab -n 10000 -c 10 -k http://127.0.0.1:8080/ | |
[Plack::Handler::Nginx] | |
- keepalive_requests 0; | |
Requests per second: 4777.98 [#/sec] (mean) |
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 Isucon; | |
use 5.14.1; | |
use Nginx::Simple; | |
use Text::Xslate::Util qw/html_escape/; | |
use POSIX qw/strftime/; | |
use List::Util qw/first/; | |
use JSON::XS; | |
use IO::Handle; | |
use Encode; |
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 5.14.1; | |
use Plack::Request; | |
use Text::Xslate::Util qw/html_escape/; | |
use POSIX qw/strftime/; | |
use List::Util qw/first/; | |
use JSON::XS; | |
use IO::Handle; | |
use Encode; | |
my $header = ['content-type' => 'text/html']; |
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 5.14.1; | |
use Plack::Request; | |
use Plack::Builder; | |
use FindBin; | |
use Text::Xslate::Util qw/html_escape/; | |
use POSIX qw/strftime/; | |
use List::Util qw/first/; | |
use JSON::XS; | |
use IO::Handle; | |
use Encode; |