| HTTP-Body documentation | Contained in the HTTP-Body distribution. |
HTTP::Body::OctetStream - HTTP Body OctetStream Parser
use HTTP::Body::OctetStream;
HTTP Body OctetStream Parser.
Christian Hansen, ch@ngmedia.com
This library is free software . You can redistribute it and/or modify it under the same terms as perl itself.
| HTTP-Body documentation | Contained in the HTTP-Body distribution. |
package HTTP::Body::OctetStream; BEGIN { $HTTP::Body::OctetStream::VERSION = '1.12'; } use strict; use base 'HTTP::Body'; use bytes; use File::Temp 0.14;
sub spin { my $self = shift; unless ( $self->body ) { $self->body( File::Temp->new( DIR => $self->tmpdir ) ); } if ( my $length = length( $self->{buffer} ) ) { $self->body->write( substr( $self->{buffer}, 0, $length, '' ), $length ); } if ( $self->length == $self->content_length ) { seek( $self->body, 0, 0 ); $self->state('done'); } }
1;