xref: /unit/test/perl/input_buffered_read/psgi.pl (revision 2060:a1991578c62e)
1use FileHandle;
2
3my $app = sub {
4    my ($environ) = @_;
5
6    $environ->{'psgi.input'}->read(my $body, 1024);
7
8    open my $io, "<", \$body;
9
10    # This makes $io work as FileHandle under 5.8, .10 and .11.
11    bless $io, 'FileHandle';
12
13    $environ->{'psgix.input.buffered'} = 1;
14    $environ->{'psgi.input'} = $io;
15
16    return ['200', ['Content-Length' => length $body], [$body]];
17};
18