[Catalyst-commits] r9570 - Catalyst-Runtime/5.80/trunk/lib

t0m at dev.catalyst.perl.org t0m at dev.catalyst.perl.org
Tue Mar 24 02:10:46 GMT 2009


Author: t0m
Date: 2009-03-24 02:10:46 +0000 (Tue, 24 Mar 2009)
New Revision: 9570

Modified:
   Catalyst-Runtime/5.80/trunk/lib/Catalyst.pm
Log:
Change plugin warning cut-off release, expand on config accessor after discussion in #catalyst the other day.

Modified: Catalyst-Runtime/5.80/trunk/lib/Catalyst.pm
===================================================================
--- Catalyst-Runtime/5.80/trunk/lib/Catalyst.pm	2009-03-24 00:17:30 UTC (rev 9569)
+++ Catalyst-Runtime/5.80/trunk/lib/Catalyst.pm	2009-03-24 02:10:46 UTC (rev 9570)
@@ -807,13 +807,35 @@
     __PACKAGE__->config( { db => 'dsn:SQLite:foo.db' } );
 
 You can also use a C<YAML>, C<XML> or C<Config::General> config file
-like myapp.yml in your applications home directory. See
+like myapp.conf in your applications home directory. See
 L<Catalyst::Plugin::ConfigLoader>.
 
-    ---
-    db: dsn:SQLite:foo.db
+=head3 Cascading configuration.
 
+The config method is present on all Catalyst components, and configuration
+will be merged when an application is started. Configuration loaded with
+L<Catalyst::Plugin::ConfigLoader> takes precedence over other configuration,
+followed by configuration in your top level C<MyApp> class. These two 
+configurations are merged, and then configuration data whos hash key matches a
+component name is merged with configuration for that component.
 
+The configuration for a component is then passed to the C<new> method when a
+component is constructed.
+
+For example:
+
+    MyApp->config({ 'Model::Foo' => { bar => 'baz', overrides => 'me' } });
+    MyApp::Model::Foo->config({ quux => 'frob', 'overrides => 'this' });
+    
+will mean that C<MyApp::Model::Foo> receives the following data when 
+constructed:
+
+    MyApp::Model::Foo->new({
+        bar => 'baz',
+        quux => 'frob',
+        overrides => 'me',
+    });
+
 =cut
 
 around config => sub {
@@ -914,7 +936,7 @@
     my ( $class, $name, $plugin, @args ) = @_;
 
     # See block comment in t/unit_core_plugin.t    
-    $class->log->warn(qq/Adding plugin using the ->plugin method is deprecated, and will be removed in Catalyst 5.9/);
+    $class->log->warn(qq/Adding plugin using the ->plugin method is deprecated, and will be removed in Catalyst 5.81/);
     
     $class->_register_plugin( $plugin, 1 );
 




More information about the Catalyst-commits mailing list