[Catalyst] __PACKAGE__->config for components from YAML

apv apv at sedition.com
Sat Jan 14 04:07:05 CET 2006


So, in a "site.yml" config file I'm doing this:

  Model::DB:
    password: ~
    user: ~
    server: blahblah
    port: ~

And then from MyApp::Model::DB I want to do this:

  my $SERVER = __PACKAGE__->config->{server} || 'localhost';

But it doesn't work. Should it? What am I doing wrong?

I can get it to work this way:

  my $SERVER = MyApp->config->{"Model::DB"}{server} || 'localhost';

or by flattening the name in the config, obviously, but that
seems prone to scaling problems.

Thanks!
-Ashley




More information about the Catalyst mailing list