fixed the comment lines for includes
authorheiko
Thu, 11 Sep 2014 11:18:00 +0200
changeset 14 ee11abdf5324
parent 13 bbb0dea458c3
child 16 67d4ed376726
fixed the comment lines for includes
lib/App/read_httpd_conf.pm
--- a/lib/App/read_httpd_conf.pm	Thu Sep 04 23:49:19 2014 +0200
+++ b/lib/App/read_httpd_conf.pm	Thu Sep 11 11:18:00 2014 +0200
@@ -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";
@@ -27,9 +28,9 @@
             redo;
         }
         if (/^\s*include\s+(?<quote>["'])?(?<file>.*?)\k<quote>?\s*$/i) {
-            my $file = substr($+{file}, 0, 1) eq '/'  ? $+{file} : "$basedir/$+{file}";
-            say "# $. $file INCLUDE $+{file}";
-            read_file($_, $basedir) foreach (glob -d $file ? "$file/*" : $file);
+            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;
         }