Created
July 4, 2011 19:34
-
-
Save ap/1063830 to your computer and use it in GitHub Desktop.
Missing Plack body filter feature?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!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