Sophie

Sophie

distrib > Mageia > 6 > x86_64 > media > core-updates > by-pkgid > 8952bf99e053a3f2fd32087e96266c63 > files > 109

perl-Plack-1.4.700-1.1.mga6.noarch.rpm

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

    warn "This app would block with sleep(): try echo-stream.psgi"
        if $env->{'psgi.nonblocking'};

    my $count;
    my $body = Plack::Util::inline_object
        getline => sub {
            return if $count++ > 5;
            sleep 1;
            return time . "\n";
        },
        close => sub {};

    return [ 200, ['X-Foo' => 'bar'], $body ];
};