Skip to content

Instantly share code, notes, and snippets.

@dann
Created January 9, 2010 13:42
Show Gist options
  • Select an option

  • Save dann/272915 to your computer and use it in GitHub Desktop.

Select an option

Save dann/272915 to your computer and use it in GitHub Desktop.
use strict;
use warnings;
use AnyEvent;
use Plack::Builder;
my $hanlder = sub {
my $env = shift;
my $cv = AE::cv;
my $w;
$w = AnyEvent->timer(
after => 3 * 1,
cb => sub {
undef $w;
$cv->send([ 200, [], ["hello, 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