/usr/share/doc/libplack-perl/examples/dot-psgi/echo-stream.psgi is in libplack-perl 1.0033-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | use AnyEvent;
my $app = sub {
my $env = shift;
warn "This app needs a server that supports psgi.streaming"
unless $env->{'psgi.streaming'};
return sub {
my $respond = shift;
my $w = $respond->([ 200, ['X-Foo' => 'bar', 'Content-Type' => 'text/plain'] ]);
my $t; $t = AE::timer 0, 1, sub {
$t;
# TODO handle client disconnect (broken pipe) and poll_cb
$w->write(time . "\n");
};
};
};
|