From: John Napiorkowski Date: Tue, 19 Jan 2010 15:37:51 +0000 (+0000) Subject: added documentation for the configuration option "action_args". X-Git-Tag: 5.80019~13^2~3 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-Runtime.git;a=commitdiff_plain;h=c813664857bab8bd99687041937b078b9590bf0c added documentation for the configuration option "action_args". --- diff --git a/lib/Catalyst/Controller.pm b/lib/Catalyst/Controller.pm index ef889bf..ee39c7b 100644 --- a/lib/Catalyst/Controller.pm +++ b/lib/Catalyst/Controller.pm @@ -446,6 +446,35 @@ of setting namespace to '' (the null string). Sets 'path_prefix', as described below. +=head2 action_args + +Allows you to set instantiation arguments on your custom Actions or ActionRoles. +You can set args globally (shared across all actions) and specifically (for a +single action). + + package MyApp::Web::Controller::MyController; + use parent 'Catalyst::Controller'; + + __PACKAGE__->config({ + action_args => { + '*' => {globalarg1=>'hello', globalarg2=>'goodbye'}, + 'specific_action' => {customarg=>'arg1'}, + }, + }); + + sub specific_action :Path('') ActionClass('CustomActionClass') {} + + 1; + +In the case above, your 'CustomActionClass' would get passed the following +arguments when it is instantiated: (globalarg1=>'hello', globalarg2=>'goodbye', +'customarg=>'arg1'). Please note that the order the arguments are passed are not +certain to be in the order declared. + +As with all other configuration hashes, you can set values inline with your +controller (as above) or centrally via a configuration file (such as you might +use with the ConfigLoader plugin). + =head1 METHODS =head2 BUILDARGS ($app, @args)