man Catalyst::Component () - Catalyst Component Base Class

NAME

Catalyst::Component - Catalyst Component Base Class

SYNOPSIS

    # lib/MyApp/Model/Something.pm
    package MyApp::Model::Something;

    use base 'Catalyst::Component';

    __PACKAGE__->config( foo => 'bar' );

    sub test {
        my $self = shift;
        return $self->{foo};
    }

    sub forward_to_me {
        my ( $self, $c ) = @_;
        $c->response->output( $self->{foo} );
    }

    1;

    # Methods can be a request step
    $c->forward(qw/MyApp::Model::Something forward_to_me/);

    # Or just methods
    print $c->comp('MyApp::Model::Something')->test;

    print $c->comp('MyApp::Model::Something')->{foo};

DESCRIPTION

This is the universal base class for Catalyst components (Model/View/Controller).

It provides you with a generic new() for instantiation through Catalyst's component loader with config() support and a process() method placeholder.

METHODS

new($c)

$c->config

$c->config($hashref)

$c->process()

SEE ALSO

Catalyst, Catalyst::Model, Catalyst::View, Catalyst::Controller.

AUTHOR

Sebastian Riedel, CWsri@cpan.org Marcus Ramberg, CWmramberg@cpan.org Matt S Trout, CWmst@shadowcatsystems.co.uk

COPYRIGHT

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