added documentation for the configuration option "action_args".
John Napiorkowski [Tue, 19 Jan 2010 15:37:51 +0000 (15:37 +0000)]
lib/Catalyst/Controller.pm

index ef889bf..ee39c7b 100644 (file)
@@ -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)