I want two special methods:
- one that runs for all URLs
- one that runs only for a specific path (/admin)
I thought the most general would be using begin
, and the method for /admin would use auto
. For example, in these two Catalyst controllers:
package MyApp::Controller::Root;
sub begin :Private {
my ($self, $c) = @_;
$c->log->debug('Run for all URLs');
}
[...]
package MyApp::Controller::Admin;
sub auto :Private {
my ($self, $c) = @_;
$c->log->debug('Run for /admin only');
}
But this does not achieve what I want. What is the correct solution?
EDIT: the problem is that Addmin::auto()
is never called, not when I access /admin or /admin/
After more tests, auto
is never called. I've tried to put auto at different places, it is never called.