I have a routine I would like to run once for each request.
After reading through the docs, I think I have found a good approach and
am wondering what others have done.
I created a base controller which uses base 'Catalyst::Controller' .
Inside the base controller I create a begin function:
sub begin : Private {
my ( $self, $c ) = @_;
$c->stash->{ controller } = $c->namespace;
}
In all my other controllers I use this base class.
If I want to add a controller specific begin routine to a controller I
place the following in that controller class:
sub begin : Private {
my ( $self, $c ) = @_;
$self->SUPER::begin($c);
# CONTROLLER SPECIFIC LOGIC HERE
}
Anyone know of any good reason to do it differently, or has anyone used
other strategies in the past?
Thanks,
Steve Francia
_______________________________________________
List: [email protected]
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/[email protected]/
Dev site: http://dev.catalyst.perl.org/