Sebastian Riedel > Mojo > Mojo::Server

Download:
Mojo-0.999914.tar.gz

Dependencies

Annotate this POD

Website

CPAN RT

Open  0
Report a bug
Source  

NAME ^

Mojo::Server - HTTP Server Base Class

SYNOPSIS ^

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

DESCRIPTION ^

Mojo::Server is a HTTP server base class.

ATTRIBUTES ^

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) = @_;
    });

METHODS ^

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

run

    $server->run;