Skip to content

Instantly share code, notes, and snippets.

@vkgtaro
Created January 9, 2010 13:32
Show Gist options
  • Save vkgtaro/272895 to your computer and use it in GitHub Desktop.
Save vkgtaro/272895 to your computer and use it in GitHub Desktop.
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