From: Gerda Shank Date: Tue, 27 Aug 2013 21:48:24 +0000 (-0400) Subject: some doc on alternatives to 'forward' X-Git-Tag: 5.90050~10 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-Runtime.git;a=commitdiff_plain;h=52c77837f218d6e2af65da09910f684bdbede08b some doc on alternatives to 'forward' --- diff --git a/lib/Catalyst.pm b/lib/Catalyst.pm index 9e7d156..4e39052 100644 --- a/lib/Catalyst.pm +++ b/lib/Catalyst.pm @@ -322,7 +322,18 @@ cookies, HTTP headers, etc.). See L. =head2 $c->forward( $class, $method, [, \@arguments ] ) -Forwards processing to another action, by its private name. If you give a +This is one way of calling another action (method) in the same or +a different controller. You can also use C<< $self->my_method($c, @args) >> +in the same controller or C<< $c->controller('MyController')->my_method($c, @args) >> +in a different controller. +The main difference is that 'forward' uses some of the Catalyst request +cycle overhead, including debugging, which may be useful to you. On the +other hand, there are some complications to using 'forward', restrictions +on values returned from 'forward', and it may not handle errors as you prefer. +Whether you use 'forward' or not is up to you; it is not considered superior to +the other ways to call a method. + +'forward' calls another action, by its private name. If you give a class name but no method, C is called. You may also optionally pass arguments in an arrayref. The action will receive the arguments in C<@_> and C<< $c->req->args >>. Upon returning from the function,