Future...::Mojo(3pm)

๐Ÿ“ฆ
version 0.17 ยท 4 versions
, in ubuntu resolute, ubuntu stonking

๐ŸŒธ Future...::Mojo(3pm) ๐ŸŒธ

okay bestie, welcome to the manual page for Future::HTTP::Mojo โ€” it's part of the User Contributed Perl Documentation crew, and it's here to make your HTTP requests go zoom asynchronously. it's also filed under Future...::Mojo(3pm) in the man pages, so if you were looking for that name, you found her ๐Ÿ’…


โœจ NAME โœจ

Future::HTTP::Mojo - asynchronous HTTP client with a Future interface ๐Ÿฆ‹


๐Ÿ’– DESCRIPTION ๐Ÿ’–

so here's the vibe: this is the backend you get when you're running with Mojo::IOLoop. it will execute the requests asynchronously. no cap, that's literally the whole point. โœจ


๐ŸŽ€ METHODS ๐ŸŽ€

๐Ÿ’… Future::HTTP::Mojo->new()

my $ua = Future::HTTP::Mojo->new();

Creates a new instance of the HTTP client. new ua, who dis ๐Ÿซถ


โญ $ua->is_async()

Returns true, because this backend is asynchronous. it's giving async main character energy, periodt. ๐Ÿ‘‘


๐ŸŒˆ $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. then you .then on it and do your lil thing ๐Ÿ’–


๐Ÿฆ‹ $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 (no body, head only, we're keeping it mysterious), just like the function in AnyEvent::HTTP. ๐Ÿ™ˆ


๐Ÿ“ $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, same as the function in AnyEvent::HTTP. sending it fr fr ๐Ÿ“ฎ


๐Ÿงš $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 your any-method wildcard girlie ๐Ÿ’œ

โš ๏ธ heads up bestie: note that this subclass will automatically collect cookies. This may or may not be the behaviour you want. so likeโ€ฆ vibe check that before you ship it ๐Ÿ˜ญ

๐Ÿ”ฅ SEE ALSO ๐Ÿ”ฅ

  • Future
  • AnyEvent::HTTP for the details of the API
  • Mojo::UserAgent for the backend

๐Ÿ’œ REPOSITORY ๐Ÿ’œ

The public repository of this module is <http://github.com/Corion/future-http>. go star it, it's iconic โญ


๐Ÿซถ SUPPORT ๐Ÿซถ

The public support forum of this module is <https://perlmonks.org/>. the monks are lowkey the bestie collective, go say hi ๐Ÿง˜


๐Ÿ› 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. not me asking you to file good bug reports, please and thank you ๐Ÿ’€


๐Ÿ‘‘ AUTHOR ๐Ÿ‘‘

Max Maischein "corion@cpan.org"


Copyright 2016-2024 by Max Maischein "corion@cpan.org".


๐ŸŒธ LICENSE ๐ŸŒธ

This module is released under the same terms as Perl itself. slay, licensing handled โœ…


and that's the whole page, bestie โ€” written against perl v5.40.1, dated 2026-01-14, filed under the Future...::Mojo(3pm) manual page. go make some async requests, you've got this ๐Ÿ’…โœจ

๐Ÿ“ฆ where this page comes from