Clio
view release on metacpan or search on metacpan
examples/test-streaming-app.psgi view on Meta::CPAN
#test-streaming-app.psgi
#usage: "plackup test-streaming-app.psgi"
use strict;
use warnings;
my $fh;
sub print_resp {
my $line;
$fh || open( $fh, "<:encoding(UTF-8)", "/var/log/syslog" );
$line = <$fh>;
return $line if defined($line);
close($fh);
$fh = undef;
}
my $app = sub {
return sub {
my $writer = shift->([200, [ "Content-type" => "text/plain"]]);
while(1) {
my $line = print_resp;
$writer->write($line) if(defined($line));
}
}
}
( run in 1.786 second using v1.01-cache-2.11-cpan-437f7b0c052 )