[Catalyst] Note re config - Documenters and module authors pleasetake note

Matt S Trout dbix-class at trout.me.uk
Fri Feb 8 07:50:09 GMT 2008


On Thu, Feb 07, 2008 at 08:33:33AM -0500, Matt Pitts wrote:
> Would it be sane to break down the hash merging magic of $c->config into
> separate methods? For example, for doing large-scale, pre-setup config
> we could have
> 
> __PACKAGE__->add_config({ name => 'MyApp', ... });
> 
> Which will make use of 'merge_config_hashes' and apply the
> C::D::Inhertiable kludging. Then __PACKAGE__->config could just be a
> getter of the whole app config which wouldn't need C::D::Inheritable
> kludging to prevent the creation a setter in __PACKAGE__.
> 
> So, doing things like
> 
> __PACKAGE__->config->{foo}{bar} = 'value';
> 
> is still safe.

That still can't be safe without a deep clone.

Which we can't do.

->config already uses merge_config_hashes. That's why using it as a setter
is safe.

-- 
      Matt S Trout       Need help with your Catalyst or DBIx::Class project?
   Technical Director                    http://www.shadowcat.co.uk/catalyst/
 Shadowcat Systems Ltd.  Want a managed development or deployment platform?
http://chainsawblues.vox.com/            http://www.shadowcat.co.uk/servers/



More information about the Catalyst mailing list