Skip to content
This repository
tag: 1.0013
Fetching contributors…

Octocat-spinner-32-eaf2f5

Cannot retrieve contributors at this time

file 20 lines (16 sloc) 0.499 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
use AnyEvent;

my $app = sub {
    my $env = shift;

    warn "This app needs a server that supports psgi.streaming and psgi.nonblocking"
        unless $env->{'psgi.streaming'} && $env->{'psgi.nonblocking'};

    return sub {
        my $respond = shift;
        my $w = $respond->([ 200, ['Content-Type' => 'text/plain'] ]);
        $w->write("Hello\n");
        my $t; $t = AE::timer 2, 0, sub {
            undef $t;
            $w->write("World\n");
            $w->close;
        };
    };
};
Something went wrong with that request. Please try again.