Plack-App-CGIBin-Streaming
view release on metacpan or search on metacpan
{
"abstract" : "allow old style CGI applications to use the plack streaming protocol",
"author" : [
"Torsten Förtsch <torsten.foertsch@gmx.net>"
],
"dynamic_config" : 0,
"generated_by" : "Dist::Milla version v1.0.4, Dist::Zilla version 5.015, CPAN::Meta::Converter version 2.141170",
"license" : [
"artistic_2"
],
"meta-spec" : {
"url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec",
---
abstract: 'allow old style CGI applications to use the plack streaming protocol'
author:
- 'Torsten Förtsch <torsten.foertsch@gmx.net>'
build_requires:
Starman: '0.3001'
Test::More: '0.88'
configure_requires:
Module::Build::Tiny: '0.037'
dynamic_config: 0
generated_by: 'Dist::Milla version v1.0.4, Dist::Zilla version 5.015, CPAN::Meta::Converter version 2.141170'
license: artistic_2
NAME
Plack::App::CGIBin::Streaming - allow old style CGI applications to use
the plack streaming protocol
SYNOPSIS
in your app.psgi:
use Plack::App::CGIBin::Streaming;
Plack::App::CGIBin::Streaming->new(root=>...)->to_app;
DESCRIPTION
With Plack already comes Plack::App::CGIBin.
lib/Plack/App/CGIBin/Streaming.pm view on Meta::CPAN
unless (defined $err) { # $sub died
warn "$env->{REQUEST_URI}: $exc";
}
};
};
}
sub serve_path {
my($self, $env, $file) = @_;
die "need a server that supports streaming" unless $env->{'psgi.streaming'};
my $app = $self->{_compiled}->{$file} ||= do {
local $0 = $file; # keep FindBin happy
$self->mkapp(CGI::Compile->compile($file));
};
$app->($env);
}
1;
__END__
=encoding utf-8
=head1 NAME
Plack::App::CGIBin::Streaming - allow old style CGI applications to use
the plack streaming protocol
=head1 SYNOPSIS
in your F<app.psgi>:
use Plack::App::CGIBin::Streaming;
Plack::App::CGIBin::Streaming->new(root=>...)->to_app;
=head1 DESCRIPTION
lib/Plack/App/CGIBin/Streaming/Request.pm view on Meta::CPAN
=head1 NAME
Plack::App::CGIBin::Streaming::Request - a helper module for
Plack::App::CGIBin::Streaming
=head1 SYNOPSIS
my $r=Plack::App::CGIBin::Streaming::Request->new(
env => $env, # set the PSGI environment
responder => $responder, # set the responder (streaming protocol)
max_buffer => 20000,
parse_headers => 1,
content_type => 'text/html; charset=utf-8',
filter_before => sub {...},
filter_after => sub {...},
on_status_output => sub {...},
on_flush => sub {...},
on_finalize => sub {...},
);
$r->writer=$writer; # set the writer (streaming protocol)
$r->notes->{key}=$value;
$r->status=404;
$r->content_type='text/html; charset=iso-8859-15';
$r->parse_headers=1;
$r->print_header(key=>$value, ...);
$r->print_content(@content);
$r->flush;
warn "It's too late to set the HTTP status" if $r->status_written;
lib/Plack/App/CGIBin/Streaming/Request.pm view on Meta::CPAN
=head3 Methods mainly used by the L<Plack::App::CGIBin::Streaming> system
=over 4
=item responder
=item writer
Here the responder and write callbacks are stored that implement the
PSGI streaming protocol.
=item finalize
This method is called by L<Plack::App::CGIBin::Streaming> after the compiled
CGI script returns. It prints out the remaining buffers and it makes the
request object almost unusable. So, even if you by accident save the request
object in a closure or similar, you cannot print to it. This is achieved by
reblessing the object into another class and scraping out the guts of the
object.
( run in 0.436 second using v1.01-cache-2.11-cpan-4d50c553e7e )