Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of git@github.com:miyagawa/Plack
- Loading branch information
Showing
12 changed files
with
268 additions
and
253 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
use CGI::Emulate::PSGI; | ||
my $handler = CGI::Emulate::PSGI->handler(sub { | ||
do "hello.cgi"; | ||
CGI::_reset_globals() if %CGI::; | ||
CGI::initialize_globals() if defined &CGI::initialize_globals; | ||
}); |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,19 @@ | ||
# emulate a slow web app that does DB query etc. | ||
use Time::HiRes qw(sleep); | ||
use Time::HiRes; | ||
|
||
sub _sleep { | ||
# If it's running in Coro, you can use Coro's co-operative multi | ||
# tasking to do time-consuming task by yeilding to other threads: | ||
# we use Coro::Timer::sleep to demonstrate that: | ||
if ($INC{"Coro.pm"}) { | ||
require Coro::Timer; | ||
Coro::Timer::sleep( $_[0] ); | ||
} else { | ||
Time::HiRes::sleep( $_[0] ); | ||
} | ||
} | ||
|
||
my $handler = sub { | ||
sleep 0.1; | ||
_sleep 0.1; # emulate the DB/IO task that takes 0.1 second | ||
return [ 200, [ "Content-Type" => "text/plain", "Content-Length" => 11 ], [ "Hello World" ] ]; | ||
}; |
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
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
Oops, something went wrong.