[Catalyst] proper flow control with $c->foward, in search of greater grok

Dennis Daupert ddaupert at gmail.com
Thu Jan 7 23:20:43 GMT 2010


On Mon, Jan 4, 2010 at 3:57 PM, Tomas Doran <bobtfish at bobtfish.net> wrote:

>
> the most important and useful thing you can forward to - an action
> directly.
>
> $c->forward($c->controller('
> Foo')->action_for('bar'), [@args]);
>

While we're on the subject, there are certain levels of grok I'd like to
attain ;-)

It seems that when chained path parts increase beyond two links, addressing
actions directly doesn't work quite as well. For example, I have these:

User.pm
User::Blog.pm
User::Blog::Entry.pm

After I add an entry to blog 'x' for user 'y', I can transport over to the
entries list for blog 'x' like so:

$c->forward($c->controller('My::Controller::User::Blog::Entry')->action_for=
('list'),
[ @args ]);
$c->detach;

Or less elegantly, like so:
$c->response->redirect($c->uri_for("/user/$user_id/blog/$blog_id/entry/list=
"));

But I can't seem to _go_ to the list (this doesn't work -- I get 'invalid
ID'):
$c->go( 'My::Controller::User::Blog::Entry', 'list', [ \@captures, \@args ]
);

Are there built-in limits to number of chained links we can dispatch by way
of directly addressing actions? Any rules/tips/guidelines in multiple
chained situations?

Thanks!

/dennis
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.scsys.co.uk/pipermail/catalyst/attachments/20100107/7840a=
1ea/attachment.htm


More information about the Catalyst mailing list