[Catalyst] Question about $c->forward()
Sebastian Riedel
sri at oook.de
Thu Nov 10 14:42:37 CET 2005
Am 10.11.2005 um 11:49 schrieb Will Hawes:
> Apologies, I didn't include the second argument to forward() in
> My::C::First in my example. It should have read:
>
> sub begin : Private {
> my ( $self, $c ) = @_;
> $c->forward('My::C::Second', 'default');
> }
>
> It's not this call to forward() that fails, it's the one in
> My::C::Second::default, which only works correctly if I use the two
> argument form of forward:
>
> $c->forward('My::C::Second', 'second');
>
> If I omit the controller name, I get the error mentioned earlier.
> But according to the docs, supplying just a method name to forward
> should result in that method being called in the current controller
> (which worked up to and including 5.33 as I mentioned). In this
> case that is not happening - Catalyst tries to call
> My::C::First::second rather than My::C::Second::second. So it is
> unsafe to pass a method name with no controller name to forward(),
> because it will break if you already forwarded from another
> controller in the same request.
>
> I've just upgraded from trunk and am still seeing the same behaviour.
5.49_04 has this bug too, thanks for finding it, it's fixed in trunk!
Upgrade or change the line
$c->forward('My::C::Second', 'default');
to
$c->forward('/second/default');
--
sebastian
More information about the Catalyst
mailing list