Mojo::Server - HTTP Server Base Class
use base 'Mojo::Server'; sub run { my $self = shift; # Get a transaction my $tx = $self->build_tx_cb->($self); # Call the handler $tx = $self->handler_cb->($self); }
Mojo::Server is a HTTP server base class.
Mojo::Server implements the following attributes.
app
my $app = $server->app; $server = $server->app(MojoSubclass->new);
app_class
my $app_class = $server->app_class; $server = $server->app_class('MojoSubclass');
build_tx_cb
my $btx = $server->build_tx_cb; $server = $server->build_tx_cb(sub { my $self = shift; return Mojo::Transaction::Single->new; });
continue_handler_cb
my $handler = $server->continue_handler_cb; $server = $server->continue_handler_cb(sub { my ($self, $tx) = @_; });
handler_cb
my $handler = $server->handler_cb; $server = $server->handler_cb(sub { my ($self, $tx) = @_; });
Mojo::Server inherits all methods from Mojo::Base and implements the following new ones.
run
$server->run;
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.