On Wed, 11 Mar 2009 15:08:19 +0100, Stefan Schlesinger wrote: > Hello!
Hi Stefan,
thanks for your bugreport!
> I tried to read my apache config using this perl module and it comes up with
> the following error:
> Cannot read '/etc/apache2/mods-enabled/*.load': No such file or directory (do
> you need to define ServerRoot?) at bug.pl line 7
> Since this is a standard Debian Apache config, I think this bug should get
> fixed...
That's indeed interesting.
I looked on 3 machines with apache2 installed, and all have quite a
few files matching /etc/apache2/mods-enabled/*.load (more precise:
symlinks to files in ../mods-available) but still I get the some
error like you with your test script.
It seems that the _include function in ConfigFile.pm doesn't like the
Include /etc/apache2/mods-enabled/*.load
syntax in /etc/apache2/apache2.conf;
open(CONF, "<$file") fails when $file = '/etc/apache2/mods-enabled/*.load'.
I've quickly created the following patch which seems to work for me,
but I'd like to have some feedback from someone with deeper perl
knowledge before I actually apply it to the package.
#v+
--- ConfigFile.pm.orig 2009-03-13 22:22:10.000000000 +0100
+++ ConfigFile.pm 2009-03-13 22:44:23.000000000 +0100
@@ -181,6 +181,17 @@
return @conf;
}
+ # Handling for wildcards
+ if ($file =~ /\/\*/) {
+ my @files = glob($file)
+ || croak("Cannot glob '$file': $!");
+ my @conf;
+ foreach (@files) {
+ push @conf, _include($_);
+ }
+ return @conf;
+ }
+
open(CONF, "<$file")
|| croak("Cannot read '$file': $! (do you need to define
ServerRoot?)");
chomp(my @conf = <CONF>);
#v-
Cheers,
gregor
--
.''`. Home: http://info.comodo.priv.at/{,blog/} / GPG Key ID: 0x00F3CFE4
: :' : Debian GNU/Linux user, admin, & developer - http://www.debian.org/
`. `' Member of VIBE!AT, SPI Inc., fellow of FSFE | http://got.to/quote/
`- NP: Don McLean: Crossroads
signature.asc
Description: Digital signature

