[Catalyst-dev] Re: Developing action_uri() for Catalyst 5.80

J. Shirley jshirley at gmail.com
Sat Jun 7 16:51:25 BST 2008


On Fri, Jun 6, 2008 at 5:47 PM, Aristotle Pagaltzis <pagaltzis at gmx.de> wrote:
> * J. Shirley <jshirley at gmail.com> [2008-06-06 23:00]:
>> My only thought is to not use strings to denote action paths.
>> $c->controller('MyController')->action_for('action') has served
>> me better.
>
> Better how? You're still passing strings, the only difference is
> you're passing two of them using a much more verbose syntax.
>
> I'm not particularly wedded to the specific syntax, though, as
> far as I care it might just as well be `MyController::action` or
> `MyController->action` instead of `/mycontroller/action`, per the
> recent discussion elsewhere.
>
> Regards,
> --
> Aristotle Pagaltzis // <http://plasmasturm.org/>
>

I'm not sure I understand your point.  If you're saying that it is all
the same to uri_for, you are wrong.
$c->controller('Foo')->action_for('action') isa Catalyst::Action
object, which stringifies to $action->reverse.  This, combined with
the special handling in uri_for for Catalyst::Action objects make it
superior.

If you are saying that $c->controller("Foo")->action_for('bar') is the
same as '/foo/bar' then... well, I am just glad we don't work on the
same code bases :)

But, regardless of all the above, I should correct and clarify my
statement that I like the admittedly verbose
$c->controller('Foo')->action_for('bar') syntax.  Instead, I dislike
passing strings.  As long as the $path bit is a Catalyst::Action
object, I think any solution is fine.



More information about the Catalyst-dev mailing list