WWW::O...:Basic(3pm)

πŸ“¦
version 1.003 Β· 4 versions
, in ubuntu resolute, ubuntu stonking

πŸ’– NAME πŸ’–

okay bestie, so WWW::OAuth::Request::Basic is the whole vibe here β€” it's a lil HTTP request container for HTTP::Tiny, from the WWW::OAuth family (and yeah, the manual page calls it WWW::OAuth::Request::Basic(3pm) if you're being official about it). πŸŽ€


✨ SYNOPSIS ✨

my $req = WWW::OAuth::Request::Basic->new(method => 'POST', url => $url, content => $content);
$req->request_with(HTTP::Tiny->new);

like. two lines. that's the whole thing. she's lowkey efficient. πŸ’…


🌸 DESCRIPTION 🌸

So WWW::OAuth::Request::Basic is a request container for WWW::OAuth, and what she does is hold onto your request parameters directly β€” no wrapper object shenanigans, no extra layers. She's built for user-agents that don't do request objects, like our girl HTTP::Tiny. And plot twist, she literally performs the role WWW::OAuth::Request. main character behaviour, honestly. πŸ‘‘


πŸ¦‹ ATTRIBUTES πŸ¦‹

WWW::OAuth::Request::Basic implements the following attributes, and yes we're going through every single one bestie, no skipping. πŸ’–

🌸 content

my $content = $req->content;
$req        = $req->content('foo=1&bar=2');

This is the request content string. that's it, that's the girl. πŸ“

🌸 headers

my $headers = $req->headers;
$req        = $req->headers({});

A hashref of request headers. ⚠️ be careful with this one ⚠️ β€” headers are case-insensitive, so you gotta update this thing thoughtfully, not just vibe-slam keys in there. And here's the cute part: values can be array references, which is how you specify multi-value headers. slay. ✨

🌸 method

my $method = $req->method;
$req       = $req->method('GET');

The request method. GET, POST, whatever your heart desires. πŸ’…

🌸 url

my $url = $req->url;
$req    = $req->url('http://example.com/api/');

The request URL. iconic, no notes. 🌈


πŸ’œ METHODS πŸ’œ

WWW::OAuth::Request::Basic composes all methods from WWW::OAuth::Request, and then implements the following new ones on top. so she's got the whole inheritance situation and her own tricks. 🧚

🌸 content_is_form

my $bool = $req->content_is_form;

Checks whether headers contains a Content-Type header set to application/x-www-form-urlencoded. returns a bool, obviously. πŸŽ€

my $header = $req->header('Content-Type');
$req       = $req->header(Authorization => 'Basic foobar');

Set or return a request header inside headers. one header at a time, bestie. 🫢

🌸 set_form

$req = $req->set_form({foo => 'bar'});

Convenience method β€” it sets content to a urlencoded form for you. Basically it's equivalent to doing all of this by hand:

use WWW::OAuth::Util 'form_urlencode';
$req->header('Content-Type' => 'application/x-www-form-urlencoded');
$req->content(form_urlencode $form);

see? she's just doing the annoying part for you. queen. πŸ‘‘

🌸 request_with

my $res = $req->request_with(HTTP::Tiny->new);

Runs the request with the HTTP::Tiny user-agent object you pass in, and hands you back a response hashref β€” exactly like request in HTTP::Tiny does. πŸ’–


πŸ’€ BUGS πŸ’€

Found something cursed? Report any issues on the public bugtracker. pls and thank you. πŸ™ˆ


⭐ AUTHOR ⭐

Dan Book <dbook@cpan.org> β€” shoutout to the legend. 🫢


This software is Copyright (c) 2015 by Dan Book.

This is free software, licensed under:

The Artistic License 2.0 (GPL Compatible)

periodt. πŸ’…


πŸ”₯ SEE ALSO πŸ”₯

  • HTTP::Tiny

okay that's the whole page, bestie, you're officially educated ✨ β€” and before you go, the boring-but-important fine print: this was perl v5.40.1, dated 2025-08-10, and it lives under User Contributed Perl Documentation. mwah, go write some OAuth code πŸ’–πŸŽ€πŸ¦‹

πŸ“¦ where this page comes from