Author: stas
Date: Tue Dec 14 18:26:31 2004
New Revision: 111916

URL: http://svn.apache.org/viewcvs?view=rev&rev=111916
Log:
more robust parser, 
- leaving -DMP_* alone
- correctly handling lines starting with # and including MP_Foo opts

Modified:
   perl/modperl/trunk/lib/ModPerl/BuildOptions.pm

Modified: perl/modperl/trunk/lib/ModPerl/BuildOptions.pm
Url: 
http://svn.apache.org/viewcvs/perl/modperl/trunk/lib/ModPerl/BuildOptions.pm?view=diff&rev=111916&p1=perl/modperl/trunk/lib/ModPerl/BuildOptions.pm&r1=111915&p2=perl/modperl/trunk/lib/ModPerl/BuildOptions.pm&r2=111916
==============================================================================
--- perl/modperl/trunk/lib/ModPerl/BuildOptions.pm      (original)
+++ perl/modperl/trunk/lib/ModPerl/BuildOptions.pm      Tue Dec 14 18:26:31 2004
@@ -77,16 +77,20 @@
 
     my @data = ();
     for (@$lines) {
-        # more than one entry on the same line
-        push @data, split /(?=MP_)/, $_;
+        chomp;
+        s/^\s+//; s/\s+$//;
+        next if /^\#/ || /^$/;
+        last if /^__END__/;
+
+        # more than one entry on the same line (but make sure to leave
+        # -DMP_* alone)
+        push @data, split /(?=\WMP_)/, $_;
     }
 
     for (@data) {
         #XXX: this "parser" should be more robust
-        chomp;
+
         s/^\s+//; s/\s+$//;
-        next if /^\#/ || /^$/;
-        last if /^__END__/;
 
         $_ = "$continue $_" if $continue;
 

Reply via email to