[Catalyst-commits] r13347 - Catalyst-Runtime/5.80/branches/docpatch_component_config/lib

rainboxx at dev.catalyst.perl.org rainboxx at dev.catalyst.perl.org
Tue Jun 15 10:29:20 GMT 2010


Author: rainboxx
Date: 2010-06-15 11:29:20 +0100 (Tue, 15 Jun 2010)
New Revision: 13347

Modified:
   Catalyst-Runtime/5.80/branches/docpatch_component_config/lib/Catalyst.pm
Log:
Applied davewood's patch.  This little doc patch might help the next one to figure out how to receive config values a little faster.

Modified: Catalyst-Runtime/5.80/branches/docpatch_component_config/lib/Catalyst.pm
===================================================================
--- Catalyst-Runtime/5.80/branches/docpatch_component_config/lib/Catalyst.pm	2010-06-15 10:20:44 UTC (rev 13346)
+++ Catalyst-Runtime/5.80/branches/docpatch_component_config/lib/Catalyst.pm	2010-06-15 10:29:20 UTC (rev 13347)
@@ -903,6 +903,21 @@
         overrides => 'me',
     });
 
+It's common practice to use a Moose attribute
+on the receiving component to access the config value.
+
+    package MyApp::Model::Foo;
+    
+    use Moose;
+    
+    # this attr will receive 'baz' at construction time
+    has 'bar' => ( 
+        is  => 'rw',
+        isa => 'Str',
+    );
+
+You can then get the value 'baz' by calling $c->model('Foo')->bar
+
 =cut
 
 around config => sub {




More information about the Catalyst-commits mailing list