Sophie

Sophie

distrib > Mageia > 7 > armv7hl > media > core-release > by-pkgid > fcb80c15e04080e741925f09ed115f0f > files > 20

perl-Plack-1.4.700-2.mga7.noarch.rpm

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;
        };
    };
};