Catalyst::Base - Catalyst Universal Base Class
# lib/MyApp/Model/Something.pm package MyApp::Model::Something; use base 'Catalyst::Base'; __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};
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.
Catalyst.
Sebastian Riedel, sri@cpan.org Marcus Ramberg, mramberg@cpan.org
sri@cpan.org
mramberg@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.