Sorry. This time with an attachment...

John Tate wrote:

Hi,

I've been trying to get C::P::ConfigLoader (0.18) to load "local" configuration files. From my reading of the documentation, if have a Config::General configuration file called "myapp.conf", I should be able to load another file named something like "myapp_local.conf", but I've not been able to make it work. I can't find any other reports of this problem, so I'm probably misreading the documentation or misusing the plugin...

However, from looking at the code and after adding my own debug calls to C::P::ConfigLoader, I think there might be a problem with the find_files method. When building the list of config files to load, it returns something like "myapp.conf_local" rather than "myapp_local.conf". That file will never get loaded into the configuration because it doesn't have the right file type to be picked up by Config::Any. Attached is a trivial patch that changes the way the method builds the filename, which makes "myapp_local.conf" get loaded as I'd expect.

John.




--
The Wellcome Trust Sanger Institute is operated by Genome Research Limited, a charity registered in England with number 1021457 and a company registered in England with number 2742969, whose registered office is 215 Euston Road, London, NW1 2BE.
--- Catalyst-Plugin-ConfigLoader-0.18/lib/Catalyst/Plugin/ConfigLoader.pm	2007-10-14 03:01:31.000000000 +0100
+++ Catalyst-Plugin-ConfigLoader-0.18.patched/lib/Catalyst/Plugin/ConfigLoader.pm	2007-11-20 12:59:10.819000000 +0000
@@ -113,7 +113,8 @@
     my @files;
     if ($extension) {
         next unless grep { $_ eq $extension } @extensions;
-        push @files, $path, "${path}_${suffix}";
+        my( $fileroot ) = $path =~ m{^(.*?)\.${extension}$};
+        push @files, $path, "${fileroot}_${suffix}.${extension}";
     } else {
         @files = map { ( "$path.$_", "${path}_${suffix}.$_" ) } @extensions;
     }
_______________________________________________
List: [email protected]
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/[EMAIL PROTECTED]/
Dev site: http://dev.catalyst.perl.org/

Reply via email to