Sebastian Riedel > Mojo > Mojo::Transaction

Download:
Mojo-0.9002.tar.gz

Dependencies

Annotate this POD

CPAN RT

Open  0
Report a bug
Source   Latest Release: Mojo-0.999909

NAME ^

Mojo::Transaction - HTTP Transaction Container

SYNOPSIS ^

    use Mojo::Transaction;

    my $tx = Mojo::Transaction->new;

    my $req = $tx->req;
    my $res = $tx->res;

    my $keep_alive = $tx->keep_alive;

DESCRIPTION ^

Mojo::Transaction is a container for HTTP transactions.

ATTRIBUTES ^

Mojo::Transaction inherits all attributes from Mojo::Stateful and implements the following new ones.

connection

    my $connection = $tx->connection;
    $tx            = $tx->connection($connection);

continued

    my $continued = $tx->continued;
    $tx           = $tx->continued(1);

keep_alive

    my $keep_alive = $tx->keep_alive;
    my $keep_alive = $tx->keep_alive(1);

kept_alive

    my $kept_alive = $tx->kept_alive;
    $tx            = $tx->kept_alive(1);

local_address

    my $address = $tx->local_address;
    $tx         = $tx->local_address('127.0.0.1');

local_port

    my $port = $tx->local_port;
    $tx      = $tx->local_port(80);

remote_address

    my $address = $tx->remote_address;
    $tx         = $tx->remote_address('127.0.0.1');

remote_port

    my $port = $tx->remote_port;
    $tx      = $tx->remote_port(80);

req

    my $req = $tx->req;
    $tx     = $tx->req(Mojo::Message::Request->new);

Returns a Mojo::Message::Request object if called without arguments. Returns the invocant if called with arguments.

res

    my $res = $tx->res;
    $tx     = $tx->res(Mojo::Message::Response->new);

Returns a Mojo::Message::Response object if called without arguments. Returns the invocant if called with arguments.

METHODS ^

Mojo::Transaction inherits all methods from Mojo::Stateful and implements the following new ones.

new_delete

    my $tx = Mojo::Transaction->new_delete('http://127.0.0.1',
        User-Agent => 'Mojo'
    );
    my $tx = Mojo::Transaction->new_delete('http://127.0.0.1', {
        User-Agent => 'Mojo'
    });

new_get

    my $tx = Mojo::Transaction->new_get('http://127.0.0.1',
        User-Agent => 'Mojo'
    );
    my $tx = Mojo::Transaction->new_get('http://127.0.0.1', {
        User-Agent => 'Mojo'
    });

new_head

    my $tx = Mojo::Transaction->new_head('http://127.0.0.1',
        User-Agent => 'Mojo'
    );
    my $tx = Mojo::Transaction->new_head('http://127.0.0.1', {
        User-Agent => 'Mojo'
    });

new_post

    my $tx = Mojo::Transaction->new_post('http://127.0.0.1',
        User-Agent => 'Mojo'
    );
    my $tx = Mojo::Transaction->new_post('http://127.0.0.1', {
        User-Agent => 'Mojo'
    });

new_put

    my $tx = Mojo::Transaction->new_put('http://127.0.0.1',
        User-Agent => 'Mojo'
    );
    my $tx = Mojo::Transaction->new_put('http://127.0.0.1', {
        User-Agent => 'Mojo'
    });