You are viewing a plain text version of this content. The canonical link for it is here.
Posted to test-dev@httpd.apache.org by Stas Bekman <st...@stason.org> on 2002/01/18 07:27:57 UTC

[patch] handling comments in the __DATA__ config sections

Currently the config generator assumes that __DATA__ sections include no 
top level comments. If you do something like:

__DATA__
# foo

you get:

Attempt to free unreferenced scalar at 
/home/stas/apache.org/mp-subproc/t/../Apache-Test/lib/Apache/TestRun.pm 
line 554.

the following patch handles the comments and copies them to the 
autogenerated httpd.conf as is.

Index: Apache-Test/lib/Apache/TestConfigPerl.pm
===================================================================
RCS file: 
/home/cvs/httpd-test/perl-framework/Apache-Test/lib/Apache/TestConfigPerl.pm,v
retrieving revision 1.44
diff -u -r1.44 TestConfigPerl.pm
--- Apache-Test/lib/Apache/TestConfigPerl.pm	14 Jan 2002 06:44:10 -0000	
1.44
+++ Apache-Test/lib/Apache/TestConfigPerl.pm	18 Jan 2002 06:26:26 -0000
@@ -200,6 +200,11 @@
          chomp;
          s/^\s+//;
          $self->replace;
+        if (/^#/) {
+            # preserve comments
+            $self->postamble($_);
+            next;
+        }
          my($directive, $rest) = split /\s+/, $_, 2;
          if ($outside_container{$directive}) {
              $self->postamble($directive => $rest);



_____________________________________________________________________
Stas Bekman             JAm_pH      --   Just Another mod_perl Hacker
http://stason.org/      mod_perl Guide   http://perl.apache.org/guide
mailto:stas@stason.org  http://ticketmaster.com http://apacheweek.com
http://singlesheaven.com http://perl.apache.org http://perlmonth.com/