[Catalyst] Setting Model Class Variable from Catalyst Config

David Schmidt davewood at gmx.at
Mon Mar 28 17:00:10 GMT 2011


On Mon, Mar 28, 2011 at 6:49 PM, Derek Wueppelmann <dwueppel at gmail.com> wrote:
> I want to be able to setup a configuration variable in my Catalyst config
> that will then be set as the value for one of my model's class variables.
> I have a model that will want to use a base path to store some files, However
> the Model doesn't know how to access Catalyst and so it can't get the data it
> needs. The other issue is that I need it as a class variable so that all of
> the instances of a particular class can access the same value once set. I'm
> thinking about calling an after method in the root Catalyst app module to set
> the variable, but I'm not sure which one I should modify.
>
> Anybody with some suggestions?
>
> --
>  o)   Derek Wueppelmann           (o
> (D .   dwueppel at gmail.com          D).
> ((`     http://www.monkeynet.ca   ( ) `
>
>
> _______________________________________________
> List: Catalyst at lists.scsys.co.uk
> Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
> Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
> Dev site: http://dev.catalyst.perl.org/
>

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

Example:
http://wiki.catalystframework.org/wiki/wikicookbook/configpass2schema



More information about the Catalyst mailing list