Catalyst::Engine - The Catalyst Engine
See Catalyst.
Add one or more actions.
$c->action( '!foo' => sub { $_[1]->res->output('Foo!') } );
Get an action's class and coderef.
my ($class, $code) = @{ $c->action('foo') };
Get a list of available actions.
my @actions = $c->action;
It also automatically calls setup() if needed.
See Catalyst::Manual::Intro for more informations about actions.
Takes a coderef with arguments and returns elapsed time as float.
my ( $elapsed, $status ) = $c->benchmark( sub { return 1 } ); $c->log->info( sprintf "Processing took %f seconds", $elapsed );
Get a component object by name.
$c->comp('MyApp::Model::MyModel')->do_stuff;
Regex search for a component.
$c->comp('mymodel')->do_stuff;
Returns an arrayref containing errors messages.
my @errors = @{ $c->errors };
Add a new error.
$c->errors('Something bad happened');
Finalize request.
Finalize headers.
Finalize output.
Forward processing to a private/public action or a method from a class. If you define a class without method it will default to process().
$c->forward('!foo'); $c->forward('index.html'); $c->forward(qw/MyApp::Model::CDBI::Foo do_stuff/); $c->forward('MyApp::View::TT');
Handles the request.
Turns the engine-specific request (Apache, CGI...) into a Catalyst context.
Prepare action.
Prepare connection.
Prepare cookies.
Prepare headers.
Prepare parameters.
Prepare path and base.
Prepare the engine request.
Prepare uploads.
Process a coderef in given class and catch exceptions. Errors are available via $c->errors.
Remove an action.
$c->remove_action('!foo');
Returns a Catalyst::Request object.
Catalyst::Request
my $req = $c->req;
Returns a Catalyst::Response object.
Catalyst::Response
my $res = $c->res;
Setup.
MyApp->setup;
Setup components.
Returns a hashref containing all your data.
$c->stash->{foo} ||= 'yada'; print $c->stash->{foo};
Sebastian Riedel, sri@cpan.org
sri@cpan.org
This program is free software, you can redistribute it and/or modify it under the same terms as Perl itself.
To install Catalyst, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Catalyst
CPAN shell
perl -MCPAN -e shell install Catalyst
For more information on module installation, please visit the detailed CPAN module installation guide.