[Catalyst] Re: proper flow control with $c->foward,
in search of greater grok
Aristotle Pagaltzis
pagaltzis at gmx.de
Mon Jan 11 09:00:55 GMT 2010
* Dennis Daupert <ddaupert at gmail.com> [2010-01-08 17:50]:
> I've tried various incarnations of go, but here's one:
>
> my @args = qw( $user_id $blog_id );
Uhm, you know that `qw` does not interpolate, right? So that line
will assign the literal strings '$user_id' and '$blog_id' into
@args, not the contents of the variables $user_id and $blog_id.
That would be why your IDs are invalid… just basic Perl stuff,
nothing to do with Catalyst.
> my @captures = $c->req->captures;
>
> $c->go( 'Blog::Controller::User::Blog::Entry', 'list', [ \@captures,
> \@args ] );
>
> I also tried with my @captures = (), @captures = qw( $user_id $blog_id );
>
> I don't see go yet.
The square brackets in the POD (which I think they are a really
bad stylistic choice there) mean that these arguments are
optional, not that you should pass those parameters inside an
anonymous array. I think you are looking for
my @caps = ( $user_id, $blog_id );
$c->go( '/user/blog/entry/list', \@caps );
or just
$c->go( '/user/blog/entry/list', [ $user_id, $blog_id ] );
Regards,
--
Aristotle Pagaltzis // <http://plasmasturm.org/>
More information about the Catalyst
mailing list