[Catalyst-dev] [Patch] Catalyst::View::Email configuration

Daniel Westermann-Clark dwc at pobox.com
Fri Jul 13 17:07:46 GMT 2007


On 2007-07-11 22:02:14 -0400, Daniel Westermann-Clark wrote:
> I was playing around with Catalyst::View::Email and ran into some
> problems configuring it via a configuration file (as opposed to
> __PACKAGE__->config).
> 
> The problem was that View::Email was not storing the configuration
> passed in from ConfigLoader.  The attached patch simply stores the
> configuration at the beginning of new.  (This seems to be a relatively
> common idiom, but I'd be happy to correct it if it's wrong.)

Thanks to mst, I've learned this is in fact wrong.  :)

Setting config at the beginning of new like this modifies class data.
Any instance will see the changes, which is not always desirable.

The correct solution is to create accessors for your config keys and
use those throughout:

http://dev.catalystframework.org/svnweb/Catalyst/revision/?rev=6525

-- 
Daniel Westermann-Clark



More information about the Catalyst-dev mailing list