Plack-Middleware-AdaptFilehandleRead

 view release on metacpan or  search on metacpan

README.mkdn  view on Meta::CPAN

       };
    

# DESCRIPTION

[PSGI](https://metacpan.org/pod/PSGI) allows for the body content to be a glob filehandle or a Filehandle
like object.  For the later case the object must have a method `getline`
which works as described in [IO::Handle](https://metacpan.org/pod/IO::Handle).  However sometimes you may have
a custom filehandle like object that support the common `read` method.  For
example many versions of [Catalyst](https://metacpan.org/pod/Catalyst) allowed the body of a response to be a
glob or object that does `read`.  People might have written custom streaming
applications that had this `read` method but not `getline`.  As a result
these custom Filehandle like objects are not compatible with the expectations
of [PSGI](https://metacpan.org/pod/PSGI).

This middleware exists to help you convert such a custom made filehandle like
object.  If you have created something like this (or for example using some
shared code like [MogileFS::Client](https://metacpan.org/pod/MogileFS::Client) that returns a filehandle that does `read`
but not `getline`) you can use this middleware to wrap said object in a proxy
that does the `getline` method by reading from the exising `read` method.

lib/Plack/Middleware/AdaptFilehandleRead.pm  view on Meta::CPAN

      $app;
    };
 
=head1 DESCRIPTION

L<PSGI> allows for the body content to be a glob filehandle or a Filehandle
like object.  For the later case the object must have a method C<getline>
which works as described in L<IO::Handle>.  However sometimes you may have
a custom filehandle like object that support the common C<read> method.  For
example many versions of L<Catalyst> allowed the body of a response to be a
glob or object that does C<read>.  People might have written custom streaming
applications that had this C<read> method but not C<getline>.  As a result
these custom Filehandle like objects are not compatible with the expectations
of L<PSGI>.

This middleware exists to help you convert such a custom made filehandle like
object.  If you have created something like this (or for example using some
shared code like L<MogileFS::Client> that returns a filehandle that does C<read>
but not C<getline>) you can use this middleware to wrap said object in a proxy
that does the C<getline> method by reading from the exising C<read> method.



( run in 0.250 second using v1.01-cache-2.11-cpan-4d50c553e7e )