Skip Menu |

This queue is for tickets about the Config-Any CPAN distribution.

Report information
The Basics
Id: 28812
Status: resolved
Priority: 0/
Queue: Config-Any

People
Owner: Nobody in particular
Requestors: peter [...] dragonstaff.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: 0.08



CC: <rataxis [...] cpan.org>
Subject: Multiple load of Config::Any::Perl files fails
Date: Mon, 13 Aug 2007 15:20:27 +0100
To: <bug-config-any [...] rt.cpan.org>
From: "Peter Edwards" <peter [...] dragonstaff.com>
Hi Joel, I'm writing a Catalyst app that connects more than one schema. package TalNF::Model::TalModel; . my $path = __PACKAGE__->config->{'home'} . '/talnf.pl'; my $cfgs = Config::Any->load_files({ files => [ $path ], use_ext => 1 }); __PACKAGE__->config( %{$cfgs->[0]})[1] ); package TalNF::Model::TalModel2; . my $path = __PACKAGE__->config->{'home'} . '/talnf.pl'; my $cfg = Config::Any->load_files({ files => [ $path ], use_ext => 1 }); __PACKAGE__->config( %{$cfgs->[0]})[1] ); This causes a problem using Config::Any::Perl because on an second attempt to load the talnf.pl config file, it's already in @INC so the "eval { require $file }" block in Config/Any/Perl.pm returns 1 rather than the file contents. I'm not sure what the best way round this is. For now, I stash a copy of the config in my first schema and access it from the second, but that's fragile. One thought I had was you could read the file inside Config::Any::Perl into a scalar then eval it from there. Alternatively you could stash the config and return it on re-reads. Anyway, hope this helps. Regards, Peter Dragonstaff Limited <http://www.dragonstaff.com/> http://www.dragonstaff.com Business IT Consultancy Skype: <callto://Peter.Edwards/> Peter.Edwards