Skip to content

Instantly share code, notes, and snippets.

@ap
Created July 4, 2011 19:34
Show Gist options
  • Save ap/1063830 to your computer and use it in GitHub Desktop.
Save ap/1063830 to your computer and use it in GitHub Desktop.
Missing Plack body filter feature?
#!perl
use Plack::Builder;
builder {
enable sub {
my $app = shift;
sub {
my $env = shift;
Plack::Util::response_cb( $app->( $env ), sub {
my @out = ( 'a' .. 'z' );
sub { shift @out }
} );
}
};
sub { [
200,
[ "Content-Type", "text/plain" ],
[ ( "Hello World\n" ) x ( ( 0 + $_[0]{'QUERY_STRING'} ) || 1 ) ]
] };
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment