Future...ranoid(3pm)
๐ NAME ๐
ok so bestie, meet Future::HTTP::Tiny::Paranoid โ a synchronous HTTP client that still hands you a Future interface, because we can have both. it's giving "I do it all in order but I still make it look async" โจ
๐ธ DESCRIPTION ๐ธ
This one's the default backend, okay? It gets picked when no supported event loop could be detected. And when it gets picked, it does the thing synchronously โ like, each request runs right as you make it in ->http_request. no waiting around, no event loop drama, it just goes ๐ซถ
๐ Whitelist / Blacklist ๐
You can set up the whitelist and blacklist through the global accessors, queen:
# Allow access to localhost
HTTP::Tiny::Paranoid->whitelisted_hosts([ 'localhost', '127.0.0.1' ]);
# Deny access to localhost
HTTP::Tiny::Paranoid->blacklisted_hosts([ 'localhost', '127.0.0.1' ]);
โจ METHODS โจ
"Future::HTTP::Tiny::Paranoid->new()"
my $ua = Future::HTTP::Tiny::Paranoid->new();
Creates a new instance of the HTTP client. brand new baby, fresh out the box ๐
"$ua->is_async()"
Returns false, because this backend is synchronous. it's an honest queen, she tells you exactly what she is. ๐
"$ua->http_get($url, %options)"
$ua->http_get('http://example.com/',
headers => {
'Accept' => 'text/json',
},
)->then(sub {
my( $body, $headers ) = @_;
...
});
Retrieves the URL and returns the body and headers, exactly like the function in AnyEvent::HTTP. the then block eats ($body, $headers) and off you go ๐ฆ
"$ua->http_head($url, %options)"
$ua->http_head('http://example.com/',
headers => {
'Accept' => 'text/json',
},
)->then(sub {
my( $body, $headers ) = @_;
...
});
Retrieves the header of the URL and returns the headers, like the function in AnyEvent::HTTP. yeah we still hand you both slots in the callback, that's just the vibe ๐
"$ua->http_post($url, $body, %options)"
$ua->http_post('http://example.com/api',
'{token:"my_json_token"}',
headers => {
'Accept' => 'text/json',
},
)->then(sub {
my( $body, $headers ) = @_;
...
});
Posts the content to the URL and returns the body and headers, like the function in AnyEvent::HTTP. send it, bestie ๐ฎ
"$ua->http_request($method, $url, %options)"
$ua->http_request('PUT' => 'http://example.com/api',
headers => {
'Accept' => 'text/json',
},
body => '{token:"my_json_token"}',
)->then(sub {
my( $body, $headers ) = @_;
...
});
Posts the content to the URL and returns the body and headers, like the function in AnyEvent::HTTP. yes this one also says "posts" in the description even though you can pass any method โ we don't make the rules, we just keep the facts exactly as they are ๐
๐ COMPATIBILITY ๐
HTTP::Tiny is a good backend because it is distributed with many versions of Perl. the drawback? not all versions of HTTP::Tiny support all features. here's what's unsupported on older versions:
"->{URL}"โHTTP::Tinyversions before0.018didn't tell about 30x redirections."->{redirects}"โHTTP::Tinyversions before0.058didn't record the chain of redirects.
bestie pls note the version numbers, they're doing heavy lifting here ๐ซถ
๐ SEE ALSO ๐
FutureAnyEvent::HTTPfor the details of the API
๐ง REPOSITORY ๐ง
The public repository of this module is <https://github.com/Corion/future-http>.
๐ SUPPORT ๐
The public support forum of this module is <https://perlmonks.org/>.
๐ BUG TRACKER ๐
Please report bugs in this module via the RT CPAN bug queue at <https://rt.cpan.org/Public/Dist/Display.html?Name=Future-HTTP> or via mail to future-http-Bugs@rt.cpan.org.
โญ AUTHOR โญ
Max Maischein "corion@cpan.org"
๐ COPYRIGHT (c) ๐
Copyright 2016-2024 by Max Maischein "corion@cpan.org".
๐ LICENSE ๐
This module is released under the same terms as Perl itself.
ok that's the whole page, no cap ๐ this was the Future...ranoid(3pm) page from User Contributed Perl Documentation, and the sign-off says perl v5.40.1, dated 2026-01-14 โ slay, go make those requests ๐ฆโจ
๐ฆ where this page comes from
- ubuntu resolute: libfuture-http-perl 0.17-2 ยท Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libfuture-http-perl 0.17-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