Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

mojo::exception(3pm) [debian man page]

Mojo::Exception(3pm)					User Contributed Perl Documentation				      Mojo::Exception(3pm)

NAME
Mojo::Exception - Exceptions with context SYNOPSIS
use Mojo::Exception; my $e = Mojo::Exception->new; DESCRIPTION
Mojo::Exception is a container for exceptions with context information. ATTRIBUTES
Mojo::Exception implements the following attributes. "frames" my $frames = $e->frames; $e = $e->frames($frames); Stacktrace. "line" my $line = $e->line; $e = $e->line([3, 'foo']); The line where the exception occured. "lines_after" my $lines = $e->lines_after; $e = $e->lines_after([[1, 'bar'], [2, 'baz']]); Lines after the line where the exception occured. "lines_before" my $lines = $e->lines_before; $e = $e->lines_before([[4, 'bar'], [5, 'baz']]); Lines before the line where the exception occured. "message" my $message = $e->message; $e = $e->message('Oops!'); Exception message. "raw_message" my $message = $e->raw_message; $e = $e->raw_message('Oops!'); Raw unprocessed exception message. "verbose" my $verbose = $e->verbose; $e = $e->verbose(1); Activate verbose rendering, defaults to the value of "MOJO_EXCEPTION_VERBOSE" or 0. METHODS
Mojo::Exception inherits all methods from Mojo::Base and implements the following new ones. "new" my $e = Mojo::Exception->new('Oops!'); my $e = Mojo::Exception->new('Oops!', $files, $name); Construct a new Mojo::Exception object. "throw" Mojo::Exception->throw('Oops!'); Mojo::Exception->throw('Oops!', $files, $name); Throw exception with stacktrace. "to_string" my $string = $e->to_string; my $string = "$e"; Render exception with context. "trace" $e = $e->trace; $e = $e->trace(2); Store stacktrace. SEE ALSO
Mojolicious, Mojolicious::Guides, <http://mojolicio.us>. perl v5.14.2 2012-09-05 Mojo::Exception(3pm)

Check Out this Related Man Page

Mojo::Server(3pm)					User Contributed Perl Documentation					 Mojo::Server(3pm)

NAME
Mojo::Server - HTTP server base class SYNOPSIS
use Mojo::Base 'Mojo::Server'; sub run { my $self = shift; # Get a transaction my $tx = $self->build_tx; # Emit "request" event $self->emit(request => $tx); } DESCRIPTION
Mojo::Server is an abstract HTTP server base class. EVENTS
Mojo::Server can emit the following events. "request" $server->on(request => sub { my ($server, $tx) = @_; ... }); Emitted when a request is ready and needs to be handled. $server->unsubscribe('request'); $server->on(request => sub { my ($server, $tx) = @_; $tx->res->code(200); $tx->res->headers->content_type('text/plain'); $tx->res->body('Hello World!'); $tx->resume; }); ATTRIBUTES
Mojo::Server implements the following attributes. "app" my $app = $server->app; $server = $server->app(MojoSubclass->new); Application this server handles, defaults to a Mojo::HelloWorld object. "app_class" my $app_class = $server->app_class; $server = $server->app_class('MojoSubclass'); Class of the application this server handles, defaults to the value of the "MOJO_APP" environment variable or Mojo::HelloWorld. METHODS
Mojo::Server inherits all methods from Mojo::EventEmitter and implements the following new ones. "new" my $server = Mojo::Server->new; Construct a new Mojo::Server object and subscribe to "request" event with default request handling. "build_tx" my $tx = $server->build_tx; Let application build a transaction. "load_app" my $app = $server->load_app('./myapp.pl'); Load application from script. say Mojo::Server->new->load_app('./myapp.pl')->home; "run" $server->run; Run server. Meant to be overloaded in a subclass. SEE ALSO
Mojolicious, Mojolicious::Guides, <http://mojolicio.us>. perl v5.14.2 2012-09-05 Mojo::Server(3pm)
Man Page