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;
my $kept_alive = $tx->kept_alive(1);

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'
});