On 6/4/07, Steve Francia <[EMAIL PROTECTED]> wrote:
Instead of the first, it gives me last controller in the chain, which leads
me to believe that this method is either called once for each controller or
called only once, but from the last controller in the chain.
It runs for all controllers in the hierarchy, top-most first. Even if
it ran the other way around, you'd still get the wrong result because
you're calling $c->namespace, which gives you the namespace of the
current running action, you want $self->namespace instead.
Perhaps there is a different approach with autochaining I should try.
you could do something like:
sub auto : Private {
my($self, $c) = @_;
push @{$c->stash->{controllers}}, $self->namespace;
return 1;
}
# in Root
sub end : Private {
my($self, $c) = @_;
$c->stash{controller} = $c->stash->{controllers}[0];
}
Although I'm not sure if this is the best way to do it, I'd much
prefer this over subclassing since things can get messy if you need to
inherit from another controller like FormBuilder or REST.
--
Eden Cardim
Instituto Baiano de Biotecnologia
Núcleo de Biologia Computacional e Gestão de Informações Biotecnológicas
Laboratório de Bioinformática
_______________________________________________
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/