The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Catalyst::Engine - The Catalyst Engine

SYNOPSIS

See Catalyst.

DESCRIPTION

METHODS

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.

benchmark

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

component / comp

Get a component object by name.

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

Regex search for a component.

    $c->comp('mymodel')->do_stuff;

errors

Returns an arrayref containing errors messages.

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

Add a new error.

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

finalize

Finalize request.

finalize_headers

Finalize headers.

finalize_output

Finalize output.

forward

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

handler

Handles the request.

prepare

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

prepare_action

Prepare action.

prepare_cookies;

Prepare cookies.

prepare_headers

Prepare headers.

prepare_parameters

Prepare parameters.

prepare_path

Prepare path and base.

prepare_request

Prepare the engine request.

prepare_uploads

Prepare uploads.

process

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

remove_action

Remove an action.

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

request (req)

Returns a Catalyst::Request object.

    my $req = $c->req;

response (res)

Returns a Catalyst::Response object.

    my $res = $c->res;

setup

Setup.

    MyApp->setup;

setup_components

Setup components.

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.