# HG changeset patch # User heiko # Date 1421071270 -3600 # Node ID 67d4ed37672659b6c2ea8e56f07b8159080eebfe # Parent 26b84b6da13929d0a95d95abde279e4f2cf34c9d# Parent ee11abdf532499df452b5a02dc946d113dbee169 [merged] some fixes diff -r 26b84b6da139 -r 67d4ed376726 lib/App/read_httpd_conf.pm --- 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+(?["'])?(?.*?)\k?\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+(?["'])?(?.*?)\k?\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; }