[Catalyst] Question about $c->forward()

Marcello m.romani at spinsoft.it
Thu Nov 10 10:37:11 CET 2005


Will Hawes ha scritto:
> package My::C::First;
> use base 'Catalyst::Base';
> 
> sub begin : Private {
>   ...
>   $c->forward('My::C::Second');
> }
> 
> package My::C::Second;
> use base 'Catalyst::Base';
> 
> sub default : Private {
>   my ( $self, $c ) = @_;
>   $c->forward('second');
> }
> 
> sub second : Local {
>   die 'ok';
> }
> 
> In the above example, My::C::Second::second used to get called before upgrading to 5.49_02, now it doesn't. Catalyst now tries to forward to My::C::First::second, doesn't find it and dies with:
> 
> Caught exception "My::C::Second did not override Catalyst::Component::process at C:/Perl/site/lib/Catalyst/Action.pm line 45"

 From my experience with Catalyst 5.23 and 5.33 this is the expected 
behaviour.
That is, if you forward to a controller, that controller must define its 
own "process" method. What would $c->forward('My::C::Second'); mean 
otherwise (i.e. what method of the package My::C::Second should catalyst 
call) ?

> 
> I'm able to get around the problem by doing $c->forward( __PACKAGE__, 'second' ) in My::C::Second::default.
> 
> The docs seem to suggest that forwarding should be to the current controller by default, i.e My::C::Second::second should get called using the one argument form of forward() as above. This is what happened with the above code under 5.33. Can someone clarify please?
> 
> _______________________________________________
> Catalyst mailing list
> Catalyst at lists.rawmode.org
> http://lists.rawmode.org/mailman/listinfo/catalyst
> 

HTH

-- 
Marcello Romani
Developer
Spin s.r.l.
Reggio Emilia
http://www.spinsoft.it




More information about the Catalyst mailing list