X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-Runtime.git;a=blobdiff_plain;f=lib%2FCatalyst.pm;h=4113fed42af5991d43b5dd6cacff90c043b14431;hp=7f0e7d2776273ec098d1f59e113dd611ab23c9a5;hb=d5e3d528ff5f0cbe8796e78fc87573653d929712;hpb=8e642f7fb9467d34b307df4b412ce3dc756e2f73 diff --git a/lib/Catalyst.pm b/lib/Catalyst.pm index 7f0e7d2..4113fed 100644 --- a/lib/Catalyst.pm +++ b/lib/Catalyst.pm @@ -76,7 +76,7 @@ __PACKAGE__->stats_class('Catalyst::Stats'); # Remember to update this in Catalyst::Runtime as well! -our $VERSION = '5.8000_01'; +our $VERSION = '5.8000_02'; sub import { my ( $class, @arguments ) = @_; @@ -1013,23 +1013,19 @@ EOF $class->setup_finished(1); } +=head2 $c->uri_for( $action, \@captures?, @args?, \%query_values? ) + =head2 $c->uri_for( $path, @args?, \%query_values? ) -Merges path with C<< $c->request->base >> for absolute URIs and with -C<< $c->namespace >> for relative URIs, then returns a normalized L -object. If any args are passed, they are added at the end of the path. -If the last argument to C is a hash reference, it is assumed to -contain GET parameter key/value pairs, which will be appended to the URI -in standard fashion. +=over -Note that uri_for is destructive to the passed hashref. Subsequent calls -with the same hashref may have unintended results. +=item $action -Instead of C<$path>, you can also optionally pass a C<$action> object -which will be resolved to a path using -C<< $c->dispatcher->uri_for_action >>; if the first element of -C<@args> is an arrayref it is treated as a list of captures to be passed -to C. +A Catalyst::Action object representing the Catalyst action you want to +create a URI for. To get one for an action in the current controller, +use C<< $c->action('someactionname') >>. To get one from different +controller, fetch the controller using C<< $c->controller() >>, then +call C on it. You can maintain the arguments captured by an action (e.g.: Regex, Chained) using C<< $c->req->captures >>. @@ -1042,6 +1038,8 @@ using C<< $c->req->captures >>. =cut +=back + sub uri_for { my ( $c, $path, @args ) = @_;