From: Sebastian Riedel Date: Thu, 6 Oct 2005 23:23:12 +0000 (+0000) Subject: Released HTTP::Body 0.01 X-Git-Tag: v0.01^0 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=09abe57d4d1afe837d8935577db1b8953a7e6447;p=catagits%2FHTTP-Body.git Released HTTP::Body 0.01 --- diff --git a/Changes b/Changes new file mode 100644 index 0000000..ceab5ef --- /dev/null +++ b/Changes @@ -0,0 +1,4 @@ +This file documents the revision history for Perl extension HTTP::Body. + +0.01 2005-09-07 00:00:00 2005 + - first release diff --git a/MANIFEST b/MANIFEST index 41ab188..5070203 100644 --- a/MANIFEST +++ b/MANIFEST @@ -1,3 +1,4 @@ +Changes lib/HTTP/Body.pm lib/HTTP/Body/MultiPart.pm lib/HTTP/Body/OctetStream.pm diff --git a/README b/README index 37cac15..6f8521c 100644 --- a/README +++ b/README @@ -3,27 +3,75 @@ NAME SYNOPSIS use HTTP::Body; + + sub handler : method { + my ( $class, $r ) = @_; + + my $content_type = $r->headers_in->get('Content-Type'); + my $content_length = $r->headers_in->get('Content-Length'); + + my $body = HTTP::Body->new( $content_type, $content_length ); + my $length = $content_length; + + while ( $length ) { + + $r->read( my $buffer, ( $length < 8192 ) ? $length : 8192 ); + + $length -= length($buffer); + + $body->add($buffer); + } + + my $uploads = $body->upload; # hashref + my $params = $body->param; # hashref + my $body = $body->body; # IO::Handle + } DESCRIPTION HTTP Body Parser. METHODS - add + new Constructor. Takes content type and content length as parameters, + returns a HTTP::Body object. + + add Add string to itnernal buffer. Will call spin unless done. returns + length before adding self. + body + accessor for the body. + buffer + read only accessor for the buffer. + content_length + read only accessor for content length + content_type + ready only accessor for the content type + init + return self. + length + read only accessor for body length. + spin + Abstract method to spin the io handle. + state + accessor for body state. + param + accesor for http parameters. + upload AUTHOR Christian Hansen, "ch@ngmedia.com" + Sebastian Riedel, "sri@cpan.org" + LICENSE - This library is free software . You can redistribute it and/or modify it + This library is free software. You can redistribute it and/or modify it under the same terms as perl itself.