HTTP::Body 1.00 release v1.00
Andy Grundman [Sat, 23 Feb 2008 16:01:45 +0000 (16:01 +0000)]
MANIFEST.SKIP
README

index 6a8b47c..20c2dd2 100644 (file)
 \#$
 \b\.#
 
-# dev scripts
+# No tarballs!
+\.gz$
 
+# dev scripts
 scripts/benchmark.pl
 scripts/stress.pl
 t/data/benchmark/*
diff --git a/README b/README
index d78c02e..a49c543 100644 (file)
--- a/README
+++ b/README
@@ -3,14 +3,14 @@ NAME
 
 SYNOPSIS
         use HTTP::Body;
-    
-        sub handler : method {
+        
+    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 $body   = HTTP::Body->new( $content_type, $content_length );
             my $length = $content_length;
 
             while ( $length ) {
@@ -18,17 +18,28 @@ SYNOPSIS
                 $r->read( my $buffer, ( $length < 8192 ) ? $length : 8192 );
 
                 $length -= length($buffer);
-            
-                $body->add($buffer);
+                
+            $body->add($buffer);
             }
-        
-            my $uploads = $body->upload; # hashref
+            
+        my $uploads = $body->upload; # hashref
             my $params  = $body->param;  # hashref
             my $body    = $body->body;   # IO::Handle
         }
 
 DESCRIPTION
-    HTTP Body Parser.
+    HTTP::Body parses chunks of HTTP POST data and supports
+    application/octet-stream, application/x-www-form-urlencoded, and
+    multipart/form-data.
+
+    Chunked bodies are supported by not passing a length value to new().
+
+    It is currently used by Catalyst to parse POST bodies.
+
+NOTES
+    When parsing multipart bodies, temporary files are created to store any
+    uploaded files. You must delete these temporary files yourself after
+    processing them.
 
 METHODS
     new Constructor. Takes content type and content length as parameters,
@@ -40,40 +51,46 @@ METHODS
     body
         accessor for the body.
 
-    buffer
-        read only accessor for the buffer.
+    chunked
+        Returns 1 if the request is chunked.
 
     content_length
-        read only accessor for content length
+        Returns the content-length for the body data if known. Returns -1 if
+        the request is chunked.
 
     content_type
-        ready only accessor for the content type
+        Returns the content-type of the body data.
 
     init
         return self.
 
     length
-        read only accessor for body length.
+        Returns the total length of data we expect to read if known. In the
+        case of a chunked request, returns the amount of data read so far.
+
+    trailing_headers
+        If a chunked request body had trailing headers, trailing_headers
+        will return an HTTP::Headers object populated with those headers.
 
     spin
         Abstract method to spin the io handle.
 
     state
-        accessor for body state.
+        Returns the current state of the parser.
 
     param
-        accesor for http parameters.
+        Get/set body parameters.
 
     upload
-
-BUGS
-    Chunked requests are currently not supported.
+        Get/set file uploads.
 
 AUTHOR
     Christian Hansen, "ch@ngmedia.com"
 
     Sebastian Riedel, "sri@cpan.org"
 
+    Andy Grundman, "andy@hybridized.org"
+
 LICENSE
     This library is free software. You can redistribute it and/or modify it
     under the same terms as perl itself.