Future...yEvent(3pm)
β¨ Future...yEvent(3pm) β¨
okay so bestie, you opened the Future...yEvent(3pm) page from the User Contributed Perl Documentation collection?? good. taste. π
buckle up because we're talking about asynchronous HTTP and it's lowkey iconic.
π¦ NAME π¦
Future::HTTP::AnyEvent β an asynchronous HTTP client with a Future interface. fr fr that's the whole glow-up. β¨
πΈ DESCRIPTION πΈ
so here's the tea β: this is the backend that gets picked for you if either AnyEvent.pm or AE.pm show up in %INC. like, the module peeks at what you already loaded and goes "oh bestie you already have AnyEvent? say less, I got you." π
and then? it runs all your requests asynchronously using AnyEvent::HTTP. no cap. non-blocking queen behavior. π
π METHODS π
π Future::HTTP::AnyEvent->new()
my $ua = Future::HTTP::AnyEvent->new();
makes you a shiny new instance of the HTTP client. that's it, that's the vibe. new ua, who dis. π«Ά
π $ua->is_async()
returns true, because this backend is asynchronous, obviously. it's giving "yes I do be like that." πβ¨
π $ua->http_get($url, %options)
$ua->http_get('http://example.com/',
headers => {
'Accept' => 'text/json',
},
)->then(sub {
my( $body, $headers ) = @_;
...
});
goes and retrieves the URL, then hands you back the body and the headers β exactly like the function in AnyEvent::HTTP does. then you .then(...) your lil callback and live your life. π₯
π $ua->http_head($url, %options)
$ua->http_head('http://example.com/',
headers => {
'Accept' => 'text/json',
},
)->then(sub {
my( $body, $headers ) = @_;
...
});
same energy but for the header of the URL β it retrieves the headers and returns them, like the function in AnyEvent::HTTP. no body, we're just peeking bestie. π
π $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. sending data out into the world, main character energy. π
π $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. this is the flexible one β you pass whatever $method you want ('PUT' in the example) and it handles it. periodt. π―
π SEE ALSO π
- Future
- AnyEvent::HTTP β for the details of the API
iykyk, go read those if you want the full lore. π
π REPOSITORY π
the public repository of this module lives at <https://github.com/Corion/future-http>. go star it, it's free bestie. β
π«Ά SUPPORT π«Ά
the public support forum of this module is at <https://perlmonks.org/>. the monks are lovely, they'll help you out. π
π 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. found a bug? don't be shy, tell them, they wanna know. π¦
π AUTHOR π
Max Maischein "corion@cpan.org" β legend behavior honestly. β¨
π COPYRIGHT (c) π
Copyright 2016-2024 by Max Maischein "corion@cpan.org". π
π LICENSE π
this module is released under the same terms as Perl itself. slay. π
and that's the whole page!! perl v5.40.1, dated 2026-01-14, straight from the Future...yEvent(3pm) manual β you're all caught up bestie, now go make some async requests and thrive. πβ¨π¦
π¦ 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