[Catalyst] uri_for
Tomas Doran
bobtfish at bobtfish.net
Wed Jan 27 21:12:17 GMT 2010
On 20 Jan 2010, at 09:40, Carl Johnstone wrote:
> Tomohiro Hosaka wrote:
>> Is this correct result?
>
> Yes, the previous situation was a bug. Given
>
> sub foo : Args(1) {
> my ($c, $arg) = @_;
> };
>
>
> The URL http://127.0.0.1/foo/bar%2Fbaz would match and set $arg to
> 'bar/baz'
> correctly. However reversing that using uri_for then returns the
> incorrect
> URL.
However, unfortunately - we have to provide compatibility - for
example c.uri_for('/static', 'css/crud', crud_type ) or similar
constructions were broken.
I've just fixed this in trunk so that if you have an action object
(with $c->uri_for_action, or $c->uri_for($c->action, or $c->uri_for($c-
>controller->action_for('foo') ) (as recommended to construct paths
to actions) - you *will* get the encoding for args and captures.
However passing in a set of strings to basically be concatenated to
the base uri and joined with / to produce paths will still work...
I think this is the best compromise between having round-trippable
URIs, and also maintaining compatibility for legacy applications.
If you feel differently, shout up now please :)
Cheers
t0m
More information about the Catalyst
mailing list