[Catalyst-commits] r12686 - Catalyst-Runtime/5.80/branches/action_args/lib/Catalyst

jnapiorkowski at dev.catalyst.perl.org jnapiorkowski at dev.catalyst.perl.org
Tue Jan 19 15:37:51 GMT 2010


Author: jnapiorkowski
Date: 2010-01-19 15:37:51 +0000 (Tue, 19 Jan 2010)
New Revision: 12686

Modified:
   Catalyst-Runtime/5.80/branches/action_args/lib/Catalyst/Controller.pm
Log:
added documentation for the configuration option "action_args".

Modified: Catalyst-Runtime/5.80/branches/action_args/lib/Catalyst/Controller.pm
===================================================================
--- Catalyst-Runtime/5.80/branches/action_args/lib/Catalyst/Controller.pm	2010-01-18 21:45:27 UTC (rev 12685)
+++ Catalyst-Runtime/5.80/branches/action_args/lib/Catalyst/Controller.pm	2010-01-19 15:37:51 UTC (rev 12686)
@@ -446,6 +446,35 @@
 
 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)




More information about the Catalyst-commits mailing list