AnyEve...Client(3pm)

πŸ“¦
version 0.0.5 Β· 2 versions
  • 0.0.5 Β· debian bookworm, debian trixie, ubuntu noble, ubuntu resolute, ubuntu stonking (latest)
  • 0.0.5 Β· ubuntu jammy
, in debian bookworm, debian trixie, ubuntu noble, ubuntu resolute, ubuntu stonking

πŸ’– NAME πŸ’–

AnyEvent::HTTP::ScopedClient β€” an AnyEvent-based lil bestie that speaks fluent https://github.com/technoweenie/node-scoped-http-client πŸ¦‹

okay so this is the AnyEve...Client(3pm) page, and yes the header truncated the name like that, iconic behaviour, we move πŸ’…


✨ VERSION ✨

version 0.0.5 πŸŽ€


🌸 SYNOPSIS 🌸

here's the whole vibe, bestie β€” copy it character for character, no editing, fr fr:

my $client = AnyEvent::HTTP::ScopedClient->new('http://example.com');
$client->request('GET', sub {
    my ($body, $hdr) = @_;    # $body is undef if error occured
    return if ( !$body || $hdr->{Status} !~ /^2/ );
    # do something;
});

# shorcut for GET
$client->get(sub {
    my ($body, $hdr) = @_;
    # ...
});

# Content-Type: application/x-www-form-urlencoded
$client->post(
    { foo => 1, bar => 2 },    # note this.
    sub {
        my ($body, $hdr) = @_;
        # ...
    }
);

# application/x-www-form-urlencoded post request
$client->post(
    "foo=1&bar=2"    # and note this.
    sub {
        my ($body, $hdr) = @_;
        # ...
    }
);

# Content-Type: application/json
use JSON::XS;
$client->header('Content-Type', 'application/json')
    ->post(
        encode_json({ foo => 1 }),
        sub {
            my ($body, $hdr) = @_;
            # ...
        }
    );

$client->header('Accept', 'application/json')
    ->query({ key => 'value' })
    ->query('key', 'value')
    ->get(
        sub {
            my ($body, $hdr) = @_;
            # ...
        }
    );

# headers at once
$client->header({
    Accept        => '*/*',
    Authorization => 'Basic abcd'
})->get(
    sub {
        my ($body, $hdr) = @_;
        # ...
    }
);

like, look at the chaining. the way that header β†’ query β†’ query β†’ get just flows?? main character energy, honestly 😭✨


πŸ¦‹ DESCRIPTION πŸ¦‹

AnyEvent::HTTP wrapper 🫢

that's it. that's the whole description. short king behaviour but it's doing exactly what it says on the tin, periodt πŸ’…


πŸ‘‘ SEE ALSO πŸ‘‘


🌟 AUTHOR 🌟

Hyungsuk Hong <hshong@perl.kr> πŸ’œ


This software is copyright (c) 2012 by Hyungsuk Hong.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.

free software besties, you can redistribute and/or modify it under the same terms as the Perl 5 programming language system itself β€” go off πŸ’–

okay that's the whole page, we ate and left no crumbs πŸ“ this was perl v5.34.0, dated 2022-06-05, and it lives under the AnyEve...Client(3pm) header. mwah πŸ’‹ 🧚

πŸ“¦ where this page comes from