Mojo::Transaction - HTTP Transaction Container
use Mojo::Transaction; my $tx = Mojo::Transaction->new; my $req = $tx->req; my $res = $tx->res; my $keep_alive = $tx->keep_alive;
Mojo::Transaction is a container for HTTP transactions.
Mojo::Transaction inherits all attributes from Mojo::Stateful and implements the following new ones.
connection
my $connection = $tx->connection; $tx = $tx->connection($connection);
continue_timeout
my $continue_timeout = $tx->continue_timeout; $tx = $tx->continue_timeout(3);
continued
my $continued = $tx->continued; $tx = $tx->continued(1);
kept_alive
my $kept_alive = $tx->kept_alive; $tx = $tx->kept_alive(1);
keep_alive
my $keep_alive = $tx->keep_alive; $tx = $tx->keep_alive(1);
local_address
my $local_address = $tx->local_address; $tx = $tx->local_address($address);
local_port
my $local_port = $tx->local_port; $tx = $tx->local_port($port);
remote_address
my $remote_address = $tx->remote_address; $tx = $tx->remote_address($address);
remote_port
my $remote_port = $tx->remote_port; $tx = $tx->remote_port($port);
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.
Mojo::Transaction inherits all methods from Mojo::Stateful and implements the following new ones.
client_connect
$tx = $tx->client_connect;
client_connected
$tx = $tx->client_connected;
client_get_chunk
my $chunk = $tx->client_get_chunk;
client_info
my ($scheme, $host, $address, $port) = $tx->client_info;
client_leftovers
my $leftovers = $tx->client_leftovers;
client_read
$tx = $tx->client_read($chunk);
client_spin
$tx = $tx->client_spin;
client_written
$tx = $tx->client_written($length);
is_writing
my $writing = $tx->is_writing;
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' });
server_accept
$tx = $tx->server_accept;
server_get_chunk
my $chunk = $tx->server_get_chunk;
server_handled
$tx = $tx->server_handled;
server_read
$tx = $tx->server_read($chunk);
server_spin
$tx = $tx->server_spin;
server_written
$tx = $tx->server_written($bytes);
To install Mojo, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Mojo
CPAN shell
perl -MCPAN -e shell install Mojo
For more information on module installation, please visit the detailed CPAN module installation guide.