Created
January 9, 2010 13:32
-
-
Save vkgtaro/272895 to your computer and use it in GitHub Desktop.
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 utf8; | |
use AnyEvent; | |
use Plack::Request; | |
use Plack::Builder; | |
use IO::Handle::Util qw(io_from_getline); | |
use Encode; | |
my $hanlder = sub { | |
my $env = shift; | |
my $boundary = '|||'; | |
my $cv = AE::cv; | |
my $w; | |
$w = AnyEvent->timer( | |
after => 0, | |
cb => sub { | |
$cv->send([ 200, ['Content-Type' => qq{multipart/mixed; boundary="$boundary"} ], "--$boundary\nContent-Type: text/htm\ | |
l\nhello, world!" ]); | |
} | |
); | |
return sub { | |
my $start_response = shift; | |
$cv->cb(sub { $start_response->( $cv->recv ) }); | |
}; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment