X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FCatalyst.pm;h=1013d21e19ae457513c8471c19344f708e283d65;hb=790ff9aafa57fa7945844173627d2c42f76d8739;hp=26b7649685ee902144f5550a3dca51368766a982;hpb=7b41db700fa469f9bf1f4aae68db378c99e30e95;p=catagits%2FCatalyst-Runtime.git diff --git a/lib/Catalyst.pm b/lib/Catalyst.pm index 26b7649..1013d21 100644 --- a/lib/Catalyst.pm +++ b/lib/Catalyst.pm @@ -892,7 +892,7 @@ component is constructed. For example: MyApp->config({ 'Model::Foo' => { bar => 'baz', overrides => 'me' } }); - MyApp::Model::Foo->config({ quux => 'frob', 'overrides => 'this' }); + MyApp::Model::Foo->config({ quux => 'frob', overrides => 'this' }); will mean that C receives the following data when constructed: @@ -903,6 +903,21 @@ constructed: 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 { @@ -3183,6 +3198,8 @@ wreis: Wallace Reis Yuval Kogman, C +rainboxx: Matthias Dietrich, C + =head1 LICENSE This library is free software. You can redistribute it and/or modify it under