--- a/lib/App/read_httpd_conf.pm Mon Jan 12 14:57:36 2015 +0100
+++ b/lib/App/read_httpd_conf.pm Mon Jan 12 15:01:10 2015 +0100
@@ -16,6 +16,7 @@
sub read_file {
my ($file, $basedir) = @_;
+ $file =~ s{/+}{/}g;
$basedir //= dirname $file;
open(my $fh, '<', $file)
or croak "Can't open $file: $!\n";
@@ -26,10 +27,10 @@
$_ .= <$fh>;
redo;
}
- if (/^\s*include(?:optional)\s+(?<quote>["'])?(?<file>.*?)\k<quote>?\s*$/i) {
- my $file = $+{file} =~ m{^/} ? $+{file} : "$basedir/$+{file}";
- say "# $. $file INCLUDE $+{file}";
- read_file($_, $basedir) foreach (glob -d $file ? "$file/*" : $file);
+ if (/^\s*include\s+(?<quote>["'])?(?<file>.*?)\k<quote>?\s*$/i) {
+ my $include_file = substr($+{file}, 0, 1) eq '/' ? $+{file} : "$basedir/$+{file}";
+ say "# $. $file INCLUDE $include_file";
+ read_file($_, $basedir) foreach (glob -d $include_file ? "$include_file/*" : $include_file);
next;
}