Skip Menu |

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

Report information
The Basics
Id: 41030
Status: resolved
Priority: 0/
Queue: Config-General

People
Owner: Nobody in particular
Requestors: alexk [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 2.40
Fixed in: (no value)



Subject: ConfigPath option not acknowledged with IncludeGlob
Hi, if files are included by means of a glob pattern having the -IncludeGlob option activated, paths specified by the -ConfigPath option are being neglected when trying to spot the files. A possible cure is being delivered as a patch file as an attachment to this bug report. Cheers, Alex
Subject: patch.txt
--- old/Config/General.pm 2008-11-18 16:32:37.000000000 +0100 +++ new/Config/General.pm 2008-11-18 16:29:39.000000000 +0100 @@ -413,6 +413,14 @@ # Something like: *.conf (or maybe dir/*.conf) was included; expand it and # pass each expansion through this method again. my @include = grep { -f $_ } bsd_glob($configfile, GLOB_BRACE | GLOB_QUOTE); + + if ( !@include && defined $this->{ConfigPath} ) { + foreach my $dir (@{$this->{ConfigPath}}) { + push @include, grep { -f $_ } bsd_glob(catfile($dir, $basefile), GLOB_BRACE | GLOB_QUOTE); + last if @include; + } + } + if (@include == 1) { $configfile = $include[0]; }
Hi, a revised version of the patch is attached. In the latest patch browsing the config path stops NOT if files have been found BUT if the directory the glob has been applied to is found with the present config path as base path. I think this approach is much more in line with the practices Config::General is following when detecting files to be included. Cheers Alexander On Di. 18. Nov. 2008, 10:52:08, ALEXK wrote: Show quoted text
> Hi, > if files are included by means of a glob pattern having the -IncludeGlob > option activated, paths specified by the -ConfigPath option are being > neglected when trying to spot the files. > > A possible cure is being delivered as a patch file as an attachment to > this bug report. > > Cheers, > Alex
--- old/Config/General.pm 2008-11-20 17:07:41.000000000 +0100 +++ new/Config/General.pm 2008-11-20 17:39:38.000000000 +0100 @@ -413,6 +413,17 @@ # Something like: *.conf (or maybe dir/*.conf) was included; expand it and # pass each expansion through this method again. my @include = grep { -f $_ } bsd_glob($configfile, GLOB_BRACE | GLOB_QUOTE); + + if ( !@include && defined $this->{ConfigPath} ) { + foreach my $dir (@{$this->{ConfigPath}}) { + my ($volume, $path, undef) = splitpath($basefile); + if ( -d catfile( $dir, $path ) ) { + push @include, grep { -f $_ } bsd_glob(catfile($dir, $basefile), GLOB_BRACE | GLOB_QUOTE); + last; + } + } + } + if (@include == 1) { $configfile = $include[0]; }
Hello AlexK, I applied the patch, looks good, thanks a lot. Will be published with version 2.41. regards, Tom