On Tue, Aug 22, 2006 at 01:37:49AM +0000, Fayland Lam wrote: > Joel Bernstein wrote: > > On Mon, Aug 21, 2006 at 10:09:10AM +0000, fayland wrote: > >> Now I'm using Config::YAML to load more than 2 yaml files in Catalyst, > >> but I wonder why ConfigLoader don't support to load more than 2 yaml > >> files? (like a.yaml b.yaml c.yaml, but not a.yaml a_local.yaml) > something like: > > __PACKAGE__->config( file => ['a.yml', 'b.yml', 'c.yml'] ); > > It doesn't work for me? What's wrong?
Well, to put it bluntly, it doesn't work because you just made that interface up. If you read the ConfigLoader synopsis at: http://search.cpan.org/~bricas/Catalyst-Plugin-ConfigLoader-0.12/lib/Catalyst/Plugin/ConfigLoader.pm#SYNOPSIS you'll see that the interface expects file => filename, ie a scalar NOT an arrayref. However, I've initiated a discussion on the catalyst-dev list about whether this is a reasonable change to make to the interface, ie for it to accept either a scalar or an arrayref of scalars. If the dev team like the idea I'll make up a patch to ConfigLoader. I'd point out at this point that anything you can do with multiple config files, you could do with a single one -- what is your rationale for needing multiple ones? Do you store each class's configuration separately? I can sort of see the logic in doing that. Please mail the list back and explain what you're doing with the multiple files, so we can understand the use case better and see if there's a better way to do what you need. At the very least it'll help me to make up a patch to get the behaviour you want. In summary, then: 1) the interface doesn't work like you think it does...for now anyway 2) you can get around it by rolling your multiple files into a single one 3) just making up an interface doesn't magically cause it to exist /joel _______________________________________________ List: [email protected] Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/[email protected]/ Dev site: http://dev.catalyst.perl.org/
