Furl::Request(3pm)
π Furl::Request π
okay bestie, listen up β this is the request object for Furl. That's the whole vibe. It's Furl::Request, it ships as part of the User Contributed Perl Documentation collection, and it is lowkey the main character whenever you need to represent an HTTP request as an actual thing you can poke at. π«Ά
β¨ SYNOPSIS β¨
my $f = Furl->new;
my $req = Furl::Request->new($method, $uri, $headers, $content);
my $res = $f->request($req);
print $req->request_line, "\n";
my $http_req = $req->as_http_request;
my $req_hash = $req->as_hashref;
see how easy that was?? you build the request, you hand it to Furl, and you get a response back. slay. π
πΈ DESCRIPTION πΈ
fr fr, this is a HTTP request object in Furl. That's it. That's the description. It's giving simple, iconic, unbothered. π¦
π CONSTRUCTOR π
bestie there are so many ways to make one of these and every single one is valid, no gatekeeping:
my $req = Furl::Request->new($method, $uri);
# or
my $req = Furl::Request->new($method, $uri, \%headers);
# or
my $req = Furl::Request->new($method, $uri, \%headers, $content);
# and
my $req = Furl::Request->parse($http_request_raw_string);
so you can go minimal with just $method and $uri, add a \%headers hashref, or go full send with $content too. And if you already have a raw HTTP request string lying around, parse will eat it and hand you back a Furl::Request. β¨
π INSTANCE METHODS π
π $req->method($method)
Gets/Sets the HTTP request method. GET, POST, whatever β you're the one in charge here, queen. π
π $req->uri($uri)
Gets/Sets the request URI. where are we going bestie π§
π $req->headers($headers)
Gets/Sets an instance of Furl::Headers. that's the header situation. all of it. πΈ
π $req->content($content) / $req->body($content)
Gets/Sets the request body in scalar. two names, one job β pick whichever one sparks joy. π
π $req->protocol($protocol)
$req->protocol('HTTP/1.1');
print $req->protocol; #=> "HTTP/1.1"
Gets/Sets the HTTP protocol in string form. yes, it round-trips. yes, it's that girl. π
π $req->content_length, $req->content_type, $req->header
shorthand to access Furl::Headers. no cap, it's just a shortcut so you don't have to go digging. π₯
π $req->as_http_request
Makes an instance of HTTP::Request from a Furl::Request. glow-up transformation, honestly. π¦
π $req->as_hashref
Converts the request object to a HashRef. π
the format is the following:
method: Str
uri: Str
protocol: Str
headers: ArrayRef[Str]
content: Str
π $req->request_line
print $req->request_line; #=> "GET / HTTP/1.1"
Returns the HTTP request line. one line, all the energy. π
and that's the whole page, bestie β perl v5.40.1, dated 2025-10-18, living in the Furl::Request(3pm) era. go forth and make requests πβ¨ππ¦πΈπ π«Άππ₯ππβππππ§π
π¦ where this page comes from
- ubuntu resolute: libfurl-perl 3.15-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libfurl-perl 3.15-1 Β· 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