The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Catalyst::Engine - The Catalyst Engine

SYNOPSIS

See Catalyst.

DESCRIPTION

METHODS

$c->action( $name => $coderef, ... )
$c->action( $name )
$c->action

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.

$c->benchmark($coderef)

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 );
$c->comp($name)
$c->component($name)

Get a component object by name.

    $c->comp('MyApp::Model::MyModel')->do_stuff;

Regex search for a component.

    $c->comp('mymodel')->do_stuff;
$c->errors
$c->errors($error, ...)
$c->errors($arrayref)

Returns an arrayref containing errors messages.

    my @errors = @{ $c->errors };

Add a new error.

    $c->errors('Something bad happened');
$c->finalize

Finalize request.

$c->finalize_headers

Finalize headers.

$c->finalize_output

Finalize output.

$c->forward($command)

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');
$c->handler($r)

Handles the request.

$c->prepare($r)

Turns the engine-specific request (Apache, CGI...) into a Catalyst context.

$c->prepare_action

Prepare action.

$c->prepare_connection;

Prepare connection.

$c->prepare_cookies;

Prepare cookies.

$c->prepare_headers

Prepare headers.

$c->prepare_parameters

Prepare parameters.

$c->prepare_path

Prepare path and base.

$c->prepare_request

Prepare the engine request.

$c->prepare_uploads

Prepare uploads.

$c->process($class, $coderef)

Process a coderef in given class and catch exceptions. Errors are available via $c->errors.

$c->remove_action($action)

Remove an action.

    $c->remove_action('!foo');
$c->request
$c->req

Returns a Catalyst::Request object.

    my $req = $c->req;
$c->response
$c->res

Returns a Catalyst::Response object.

    my $res = $c->res;
$class->setup

Setup.

    MyApp->setup;
$class->setup_components

Setup components.

$c->stash

Returns a hashref containing all your data.

    $c->stash->{foo} ||= 'yada';
    print $c->stash->{foo};

AUTHOR

Sebastian Riedel, sri@cpan.org

COPYRIGHT

This program is free software, you can redistribute it and/or modify it under the same terms as Perl itself.