Added a BUG section and fixed some POD typos
[catagits/HTTP-Body.git] / README
1 NAME
2     HTTP::Body - HTTP Body Parser
3
4 SYNOPSIS
5         use HTTP::Body;
6     
7         sub handler : method {
8             my ( $class, $r ) = @_;
9
10             my $content_type   = $r->headers_in->get('Content-Type');
11             my $content_length = $r->headers_in->get('Content-Length');
12         
13             my $body   = HTTP::Body->new( $content_type, $content_length );
14             my $length = $content_length;
15
16             while ( $length ) {
17
18                 $r->read( my $buffer, ( $length < 8192 ) ? $length : 8192 );
19
20                 $length -= length($buffer);
21             
22                 $body->add($buffer);
23             }
24         
25             my $uploads = $body->upload; # hashref
26             my $params  = $body->param;  # hashref
27             my $body    = $body->body;   # IO::Handle
28         }
29
30 DESCRIPTION
31     HTTP Body Parser.
32
33 METHODS
34     new Constructor. Takes content type and content length as parameters,
35         returns a HTTP::Body object.
36
37     add Add string to itnernal buffer. Will call spin unless done. returns
38         length before adding self.
39
40     body
41         accessor for the body.
42
43     buffer
44         read only accessor for the buffer.
45
46     content_length
47         read only accessor for content length
48
49     content_type
50         ready only accessor for the content type
51
52     init
53         return self.
54
55     length
56         read only accessor for body length.
57
58     spin
59         Abstract method to spin the io handle.
60
61     state
62         accessor for body state.
63
64     param
65         accesor for http parameters.
66
67     upload
68
69 AUTHOR
70     Christian Hansen, "ch@ngmedia.com"
71
72     Sebastian Riedel, "sri@cpan.org"
73
74 LICENSE
75     This library is free software. You can redistribute it and/or modify it
76     under the same terms as perl itself.
77