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

Will Hawes info at whawes.co.uk
Thu Nov 10 10:19:05 CET 2005


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"

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?



More information about the Catalyst mailing list