.\" Automatically generated by Pod::Man 4.09 (Pod::Simple 3.35) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .if !\nF .nr F 0 .if \nF>0 \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} .\} .\" ======================================================================== .\" .IX Title "HTTP::MultiPartParser 3pm" .TH HTTP::MultiPartParser 3pm "2017-11-12" "perl v5.26.1" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" HTTP::MultiPartParser \- HTTP MultiPart Parser .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 5 \& $parser = HTTP::MultiPartParser\->new( \& boundary => $boundary, \& on_header => $on_header, \& on_body => $on_body, \& ); \& \& while ($octets = read_octets_from_body()) { \& $parser\->parse($octets); \& } \& \& $parser\->finish; .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" This class provides a low-level \s-1API\s0 for processing MultiPart \s-1MIME\s0 data streams conforming to MultiPart types as defined in \s-1RFC 2616\s0 . .SH "METHODS" .IX Header "METHODS" .SS "new" .IX Subsection "new" .Vb 1 \& $parser = HTTP::MultiPartParser\->new( %attributes ); .Ve .PP This constructor returns a instance of \f(CW\*(C`HTTP::MultiPartParser\*(C'\fR. Valid attributes inculde: .IP "\(bu" 4 \&\f(CW\*(C`boundary\*(C'\fR (Mandatory) .Sp .Vb 1 \& boundary => $value .Ve .Sp The unquoted and unescaped \fIboundary\fR parameter value from the Content-Type header field. The \fIboundary\fR parameter value consist of a restricted set of characters as defined in \s-1RFC 2046\s0 . .Sp .Vb 3 \& DIGIT / ALPHA / "\*(Aq" / "(" / ")" / \& "+" / "_" / "," / "\-" / "." / \& "/" / ":" / "=" / "?" .Ve .IP "\(bu" 4 \&\f(CW\*(C`on_header\*(C'\fR (Mandatory) .Sp .Vb 1 \& on_header => $callback\->($header) .Ve .Sp This callback will be invoked when the header of a part has successfully been received. The callback will only be invoked once for each part. .IP "\(bu" 4 \&\f(CW\*(C`on_header_as\*(C'\fR .Sp .Vb 1 \& on_header_as => \*(Aqunparsed\*(Aq | \*(Aqlines\*(Aq .Ve .Sp Defines the \f(CW$header\fR value for the \f(CW\*(C`on_header\*(C'\fR callback. .RS 4 .IP "\(bu" 4 \&\f(CW\*(C`unparsed\*(C'\fR .Sp Callback invoked with an octet string containing the unparsed header. .IP "\(bu" 4 \&\f(CW\*(C`lines\*(C'\fR .Sp Callback invoked with an \s-1ARRAY\s0 reference, where each element of the array is a header line. Folding whitespace is removed from all lines and header continuation lines are unwrapped. .RE .RS 4 .RE .IP "\(bu" 4 \&\f(CW\*(C`on_body\*(C'\fR (Mandatory) .Sp .Vb 1 \& on_body => $callback\->($chunk, $final) .Ve .Sp This callback will be invoked when there is any data available for the body of a part. The callback may be invoked multiple times for each part. .IP "\(bu" 4 \&\f(CW\*(C`on_error\*(C'\fR .Sp .Vb 1 \& on_error => $callback\->($message) .Ve .Sp This callback will be invoked anytime an error occurs in the parser. After receiving an error the parser is no longer useful in its current state. .IP "\(bu" 4 \&\f(CW\*(C`max_preamble_size\*(C'\fR .Sp .Vb 1 \& max_preamble_size => 32768 .Ve .IP "\(bu" 4 \&\f(CW\*(C`max_header_size\*(C'\fR .Sp .Vb 1 \& max_header_size => 32768 .Ve .SS "parse" .IX Subsection "parse" .Vb 1 \& $parser\->parse($octets); .Ve .PP Parses the given octets. .SS "finish" .IX Subsection "finish" .Vb 1 \& $parser\->finish; .Ve .PP Finish the parsing. .SS "reset" .IX Subsection "reset" .Vb 1 \& $parser\->reset; .Ve .PP Resets the state of the parser. .SS "is_aborted" .IX Subsection "is_aborted" .Vb 1 \& $boolean = $parser\->is_aborted; .Ve .PP Returns true if an error has occurred in the parser. .SH "DIAGNOSTICS" .IX Header "DIAGNOSTICS" .ie n .IP "\fB(F)\fR Usage: %s" 4 .el .IP "\fB(F)\fR Usage: \f(CW%s\fR" 4 .IX Item "(F) Usage: %s" Method called with wrong number of arguments. .SH "SEE ALSO" .IX Header "SEE ALSO" .IP "\s-1RFC 2616\s0 section 3.7.2 Multipart Types " 4 .IX Item "RFC 2616 section 3.7.2 Multipart Types " .PD 0 .IP "\s-1RFC 2046\s0 section 5.1.1 Common Syntax " 4 .IX Item "RFC 2046 section 5.1.1 Common Syntax " .IP "\s-1RFC 2388\s0 multipart/form\-data " 4 .IX Item "RFC 2388 multipart/form-data " .PD .SH "SUPPORT" .IX Header "SUPPORT" .SS "Bugs / Feature Requests" .IX Subsection "Bugs / Feature Requests" Please report any bugs or feature requests through the issue tracker at . You will be notified automatically of any progress on your issue. .SS "\s-1SOURCE CODE\s0" .IX Subsection "SOURCE CODE" This is open source software. The code repository is available for public review and contribution under the terms of the license. .PP .PP .Vb 1 \& git clone https://github.com/chansen/p5\-http\-multipartparser .Ve .SH "AUTHOR" .IX Header "AUTHOR" Christian Hansen \f(CW\*(C`chansen@cpan.org\*(C'\fR .SH "COPYRIGHT" .IX Header "COPYRIGHT" Copyright 2012\-2017 by Christian Hansen. .PP This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.