[Catalyst-dev] RFC: action_uri

Jonathan Rockway jon at jrock.us
Mon Oct 2 18:12:55 CEST 2006


>     $c->controller('Foo::Bar')->action_for('baz')->uri_for($c, bla);

This is my favorite, although I would write:

    $c->controller('Foo::Bar')->action('baz')->uri({key => "value"});

Basically I have two questions in my mind after reading your proposed
syntax:

1) Why is there a distinction between controller and action (controller
is just controller, action is action_for)
2) Why pass another Catalyst context to uri_for at the end? (and again,
why the _for?)

I think I partially understand 1.  Theoretically, action_for runs the
URI matching rules against the actions inside the controller; i.e. baz
would map to action quux if quux looks like

    sub quux : LocalRegex('...') {}

I think 99% of the time people want that to happen, rather than to refer
to the subroutine Foo::Bar::quux directly.

BTW, how does (will?) uri_for map Regex actions to URIs?  Isn't that NP
complete?  (Haven't tried it.)

Regards,
Jonathan Rockway

-- 
package JAPH;use Catalyst qw/-Debug/;($;=JAPH)->config(name => do {
$,.=reverse qw[Jonathan tsu rehton lre rekca Rockway][$_].[split //,
";$;"]->[$_].q; ;for 1..4;$,=~s;^.;;;$,});$;->setup;



More information about the Catalyst-dev mailing list