Future...::Tiny(3pm)
β¨ NAME β¨
Future::HTTP::Tiny β bestie, it's a synchronous HTTP client that still hands you a Future interface, like a little gift π. That's the whole vibe: sync under the hood, future-shaped on top. π
It's a 3pm manual page, so consider this the group chat where we spill all the tea about it. π«
πΈ DESCRIPTION πΈ
Okay so listen: this is the default backend. The way this works is, if no supported event loop could be detected, you get this one. Periodt. β¨
And because there's no event loop to play with, it just executes the requests synchronously as they're made inside ->http_request. No async shenanigans, no waiting around for the loop to wake up β it just does the thing right then. π
π METHODS π
π¦ Future::HTTP::Tiny->new()
my $ua = Future::HTTP::Tiny->new();
Creates a brand new instance of the HTTP client. Your shiny new $ua, slay. π
π $ua->is_async()
Returns false, because this backend is synchronous. That's it, that's the whole function β it's giving honesty. It's not async, it never claimed to be async, and it's not about to lie to you. π
π $ua->http_get($url, %options)
$ua->http_get('http://example.com/',
headers => {
'Accept' => 'text/json',
},
)->then(sub {
my( $body, $headers ) = @_;
...
});
Retrieves the URL and hands you back the body and the headers, just like the function does in AnyEvent::HTTP. Then ->then gets called with $body and $headers and you can go off. π₯
π $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, matching the function in AnyEvent::HTTP. Same API energy, different verb. β¨
π§ $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, again exactly like the function in AnyEvent::HTTP. Sending the payload, 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 β yep, like the function in AnyEvent::HTTP. This is the one where you pick your own $method, so it's giving main character energy. π
π COMPATIBILITY π
HTTP::Tiny is genuinely a good backend because it ships with, like, so many versions of Perl. Built in, no extra install, iconic. π
But β and this is the plot twist π β the drawback is that not all versions of HTTP::Tiny support all features. The following features are simply unsupported on older versions of HTTP::Tiny:
->{URL}βHTTP::Tinyversions before0.018didn't tell about 30x redirections. π->{redirects}βHTTP::Tinyversions before0.058didn't record the chain of redirects. π
So if you're on an ancient HTTP::Tiny and wondering why those keys are ghosting you, that's why. iykyk.
π₯ SEE ALSO π₯
FutureAnyEvent::HTTPfor the details of the API
Go read those if you want the full picture, bestie. π
π«Ά 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.
Bestie, if something's broken, tell the maintainers, don't suffer in silence. π₯Ί
β 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.
And that's the whole page, fr fr π β written for perl v5.40.1, dated 2026-01-14, and catalogued as Future::HTTP::Tiny(3pm). Thanks for reading this far, bestie, you ate. π
β¨
π¦ 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