Dennis Daupert wrote:
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;
Right, but forward visits _one action_, only..
Or less elegantly, like so:
$c->response->redirect($c->uri_for("/user/$user_id/blog/$blog_id/entry/list"));
Eww, don't do that.
You want
$c->response->redirect($c->uri_for_action('/user/blog/entry/list',
[$user_id, $blog_id]));
And it should be noted that redirect and forward are _totally_ different
things, used for totally different purposes.
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 ] );
Not specific enough. You get 'invalid ID' where, from what?
Please show use the debug table from app startup and for the hit in
question which has the issue?
At a guess what you're doing wrong is not ->go ing to the end of the
chain - you can _only_ go to chain endpoints (rather than individual
actions) as go does a full redispatch.
Are there built-in limits to number of chained links we can dispatch by
way of directly addressing actions?
No.
Any rules/tips/guidelines in
multiple chained situations?
DO NOT CONSTRUCT PATHS MANUALLY.
USE ACTION OBJECTS OR uri_for_action.
That is all :)
Cheers
t0m
_______________________________________________
List: Catalyst@lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/