X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-Runtime.git;a=blobdiff_plain;f=lib%2FCatalyst.pm;h=7f0e7d2776273ec098d1f59e113dd611ab23c9a5;hp=b0d30d7b3e8923547fd023c4487ddf868249a85a;hb=8e642f7fb9467d34b307df4b412ce3dc756e2f73;hpb=df543cc2e7a9697150669a51f2dd9292b0cba412 diff --git a/lib/Catalyst.pm b/lib/Catalyst.pm index b0d30d7..7f0e7d2 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.7099_03'; +our $VERSION = '5.8000_01'; sub import { my ( $class, @arguments ) = @_; @@ -346,13 +346,33 @@ When called with no arguments it escapes the processing chain entirely. sub detach { my $c = shift; $c->dispatcher->detach( $c, @_ ) } +=head2 $c->visit( $action [, \@arguments ] ) + +=head2 $c->visit( $class, $method, [, \@arguments ] ) + +Almost the same as C, but does a full dispatch, instead of just +calling the new C<$action> / C<$class-E$method>. This means that C, +C and the method you go to are called, just like a new request. + +C<$c-Estash> is kept unchanged. + +In effect, C allows you to "wrap" another action, just as it +would have been called by dispatching from a URL, while the analogous +C allows you to transfer control to another action as if it had +been reached directly from a URL. + +=cut + +sub visit { my $c = shift; $c->dispatcher->visit( $c, @_ ) } + =head2 $c->go( $action [, \@arguments ] ) =head2 $c->go( $class, $method, [, \@arguments ] ) -Almost the same as C, but does a full dispatch, instead of just -calling the new C<$action> / C<$class-E$method>. This means that C, -C and the method you go to is called, just like a new request. +Almost the same as C, but does a full dispatch like C, +instead of just calling the new C<$action> / +C<$class-E$method>. This means that C, C and the +method you visit are called, just like a new request. C<$c-Estash> is kept unchanged. @@ -1011,6 +1031,15 @@ 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. +You can maintain the arguments captured by an action (e.g.: Regex, Chained) +using C<< $c->req->captures >>. + + # For the current action + $c->uri_for($c->action, $c->req->captures); + + # For the Foo action in the Bar controller + $c->uri_for($c->controller->('Bar')->action_for('Foo'), $c->req->captures); + =cut sub uri_for { @@ -2475,6 +2504,8 @@ Gary Ashton Jones Geoff Richards +ilmari: Dagfinn Ilmari Mannsåker + jcamacho: Juan Camacho Jody Belka @@ -2505,6 +2536,8 @@ omega: Andreas Marienborg phaylon: Robert Sedlacek +rafl: Florian Ragwitz + sky: Arthur Bergman the_jester: Jesse Sheidlower