POE::F...:Parser(3pm)
β¨ NAME β¨
POE::Filter::HTTP::Parser β bestie, it's literally a HTTP POE filter for HTTP clients or servers π (this is from the User Contributed Perl Documentation, POE::F...:Parser(3pm), in case you were wondering which manual page you just opened π«Ά)
π VERSION π
version 1.08 β yes, that's the one, no cap.
πΈ SYNOPSIS πΈ
okay so here's the vibe, copy-paste ready:
use POE::Filter::HTTP::Parser;
# For HTTP Servers
my $request_filter = POE::Filter::HTTP::Parser->new( type => 'server' );
my $arrayref_of_request_objects = $filter->get( [ $stream ] );
my $arrayref_of_HTTP_stream = $filter->put( $arrayref_of_response_objects );
# For HTTP clients
my $response_filter = POE::Filter::HTTP::Parser->new( type => 'client' );
my $arrayref_of_HTTP_stream = $filter->put( $arrayref_of_request_objects );
my $arrayref_of_response_objects = $filter->get( [ $stream ] );
π¦ DESCRIPTION π¦
POE::Filter::HTTP::Parser is a POE::Filter for HTTP that's built on top of HTTP::Parser. It's giving "I make your life easier" energy.
It can be used to easily create POE based HTTP servers or clients. π
When type is set to "client" β which is the default behaviour, bestie, that's the one you get for free β get will parse HTTP::Response objects from HTTP streams, and put will accept HTTP::Request objects and convert them to HTTP streams.
When type is set to "server", the reverse will happen. get will parse HTTP::Request objects from HTTP streams, and put will accept HTTP::Response objects and convert them to HTTP streams. And like POE::Filter::HTTPD, if there is an error parsing the HTTP request, this filter will generate a HTTP::Response object instead, to encapsulate the error message, suitable for simply sending back to the requesting client. π«Ά so thoughtful.
π CONSTRUCTOR π
"new"
Creates a new POE::Filter::HTTP::Parser object. Takes one optional argument, "type", which determines whether the filter will act in "client" or "server" mode. "client" is the default if "type" is not specified.
'type', set to either 'client' or 'server', default is 'client';
β METHODS β
"get"
"get_one_start"
"get_one"
Takes an arrayref which contains lines of text. Returns an arrayref of either HTTP::Request or HTTP::Response objects depending on the "type" that has been specified. π
"get_pending"
Returns any data remaining in a filter's input buffer. The filter's input buffer is not cleared, however. Returns an array reference if there's any data, or undef if the filter was empty. lowkey useful, fr fr.
"put"
Takes an arrayref of either HTTP::Response objects or HTTP::Request objects depending on whether "type" is set to "server" or "client", respectively.
If "type" is "client", then this accepts HTTP::Request objects. If "type" is "server", then this accepts HTTP::Response objects.
This does make sense if you think about it. π
The given objects are returned to their stream form.
"clone"
Makes a copy of the filter, and clears the copy's buffer. fresh start energy β¨
π CREDITS π
The "put" method for HTTP responses was borrowed from POE::Filter::HTTPD, along with the code to generate HTTP::Response on a parse error, by Artur Bergman and Rocco Caputo. iconic collaboration, honestly π
π SEE ALSO π
POE::FilterHTTP::ParserPOE::Filter::HTTPD
π AUTHOR π
Chris Williams <chris@bingosnet.co.uk>
π COPYRIGHT AND LICENSE π
This software is copyright (c) 2016 by Chris Williams, Artur Bergman and Rocco Caputo.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
okay bestie that's the whole page, every flag, every method, every credit, nothing skipped π
and that's a wrap on the POE::F...:Parser(3pm) page from perl v5.34.0, dated 2022-06-17 β go build something iconic with it, mwah ππβ¨
π¦ where this page comes from
- debian bookworm: libpoe-filter-http-parser-perl 1.08-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- debian trixie: libpoe-filter-http-parser-perl 1.08-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: libpoe-filter-http-parser-perl 1.08-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libpoe-filter-http-parser-perl 1.08-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libpoe-filter-http-parser-perl 1.08-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms