The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Mojo::Client - Client

SYNOPSIS

    use Mojo::Client;
    use Mojo::Transaction;

    my $tx = Mojo::Transaction->new;
    $tx->req->method('GET');
    $tx->req->url->parse('http://cpan.org');

    my $client = Mojo::Client->new;
    $client->process($tx);

DESCRIPTION

Mojo::Client is a full featured async io HTTP 1.1 client.

ATTRIBUTES

continue_timeout

    my $timeout = $client->continue_timeout;
    $client     = $client->continue_timeout(5);

keep_alive_timeout

    my $keep_alive_timeout = $client->keep_alive_timeout;
    $client                = $client->keep_alive_timeout(15);

select_timeout

    my $timeout = $client->select_timeout;
    $client     = $client->select_timeout(5);

METHODS

Mojo::Client inherits all methods from Mojo::Base and implements the following new ones.

connect

    $tx = $client->connect($tx);

disconnect

    $tx = $client->disconnect($tx);

deposit_connection

    $client->deposit_connection($name, $connection, $timeout);

process

    @transactions = $client->process(@transactions);

process_all

    @transactions = $client->process_all(@transactions);

process_local

    $tx = $client->process_local('MyApp', $tx);

Returns a processed Mojo::Transaction object. Expects a Mojo application class name and a Mojo::Transaction object as arguments.

spin

    my $done = $client->spin(@transactions);

test_connection

    my $alive = $client->test_connection($connection);

withdraw_connection

    my $connection = $client->withdraw_connection($name);