FAQ
hi.

I used Catalyst comfortably.

I update catalyst module to recent version (5.80018) yesterday.

[before updated]
my $request = Catalyst::Request->new( {
base => URI->new('http://127.0.0.1/foo')
} );
Catalyst::uri_for( $context, '/', 'bar/baz' )->as_string; # http://127.0.0.1/foo/bar/baz

[after updated]
my $request = Catalyst::Request->new( {
base => URI->new('http://127.0.0.1/foo')
} );
Catalyst::uri_for( $context, '/', 'bar/baz' )->as_string; # http://127.0.0.1/foo/bar%2Fbaz

I suspect different result from
http://dev.catalystframework.org/svnweb/Catalyst/diff/Catalyst-Runtime/5.80/trunk/lib/Catalyst.pm?rev1811;rev2812

Is this correct result?

Cheers,
bokutin

Search Discussions

  • Carl Johnstone at Jan 20, 2010 at 9:40 am

    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.

    Carl
  • Tomas Doran at Jan 27, 2010 at 9:10 pm

    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

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupcatalyst @
categoriescatalyst, perl
postedJan 20, '10 at 7:14a
activeJan 27, '10 at 9:10p
posts3
users3
websitecatalystframework.org
irc#catalyst

People

Translate

site design / logo © 2021 Grokbase