[Catalyst] more thoughts on $c->foward

Tomas Doran bobtfish at bobtfish.net
Sat Feb 13 01:01:28 GMT 2010


On 12 Feb 2010, at 19:10, Tommy Butler wrote:

> <tommy>
> $c->forward($c->controller('Helper::Ajax')- 
> >action_for('nocache_headers'));

Actually, please ignore last response - you're not generating URIs,  
you're calling code.

Don't do that.

Use an action role (Catalyst::Controller::ActionRole), or  
parameterised role (MX::Role::Parameterised) to apply method modifiers  
around the actions whose behavior you would like to decorate, rather  
than explicitly forwarding to the 'extra' code you'd like run with the  
action..

e.g. sub foo :Does("MyAjaxShiz') { }

Cheers
t0m




More information about the Catalyst mailing list