[Catalyst] Setting Model Class Variable from Catalyst Config

Eden Cardim edencardim at gmail.com
Mon Apr 11 19:37:41 GMT 2011

>>>>> "David" == David Schmidt <davewood at gmx.at> writes:

    David> Usually that's achieved by adding an attribute to your model and then
    David> providing the value at model instantiation time

--8<---------------cut here---------------start------------->8---
MyApp->config->{Model::Foo}{bar} = 'baz';

package MyApp::Model::Foo;
has bar => (is => 'ro');
--8<---------------cut here---------------end--------------->8---

The above should set the bar attribute during load time for you straight
out of the box.

   Eden Cardim       Need help with your Catalyst or DBIx::Class project?
  Code Monkey                    http://www.shadowcat.co.uk/catalyst/
 Shadowcat Systems Ltd.  Want a managed development or deployment platform?
http://blog.edencardim.com/            http://www.shadowcat.co.uk/servers/

More information about the Catalyst mailing list