Re: Mod Perl Code failures

[prev] [thread] [next] [Date index for 2005/05/25]

From: Stas Bekman
Subject: Re: Mod Perl Code failures
Date: 17:12 on 25 May 2005
[CC'ing the modperl list where all the bug reports should go to, hint, hint]

Discover Life WebAdmin wrote:
> Stas, I'm sure you get millions of emails a day.  But, I'm writing to tell
> you about a code failure in our server: pick18.pick.uga.edu
> We are running the following apache2 setup:
> Apache/2.0.54 (Unix) mod_ssl/2.0.54 OpenSSL/0.9.7c PHP/5.0.4
> mod_perl/1.999.23 Perl/v5.8.6
> 
> In mod_perl 1, we were able to code using regular expressions to recognize
> __END__ in some of our accessory files to the code.  However, mod_perl 2
> recognizes end statements ANYWHERE.  Even if the end statement is
> commented out with a # sign, the __END__ is picked up and we get all sorts
> of code failures.  It seems that bug is that __END__ in the programs is
> not forced to be at the beginning of the line.  I feel that __END__ should
> be able to exist in a regular expression or in a comment without bombing
> all of the program.

That's a bug, Justin. And here is the fix. Will be out in mod_perl 2.0.1.

Index: ModPerl-Registry/t/cgi-bin/basic.pl
===================================================================
--- ModPerl-Registry/t/cgi-bin/basic.pl (revision 171124)
+++ ModPerl-Registry/t/cgi-bin/basic.pl (working copy)
@@ -3,8 +3,13 @@
  # test all the basic functionality

  print "Content-type: text/plain\n\n";
+
+# test that __END__ can appear in a comment w/o cutting data after it
+
  print "ok $0";

+# test that __END__ starting at the beginning of the line makes
+# everything follow it stripped
  __END__

  this is some irrelevant data
Index: ModPerl-Registry/lib/ModPerl/RegistryCooker.pm
===================================================================
--- ModPerl-Registry/lib/ModPerl/RegistryCooker.pm      (revision 171124)
+++ ModPerl-Registry/lib/ModPerl/RegistryCooker.pm      (working copy)
@@ -645,7 +645,7 @@
  #########################################################################

  sub strip_end_data_segment {
-    ${ +shift->{CODE} } =~ s/__(END|DATA)__(.*)//s;
+    ${ +shift->{CODE} } =~ s/^__(END|DATA)__(.*)//ms;
  }




        -- 
        __________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:stas@xxxxxx.xxx http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com

Re: Mod Perl Code failures
Stas Bekman 17:12 on 25 May 2005

Re: Mod Perl Code failures
iain hubbard 09:23 on 26 May 2005

Re: Mod Perl Code failures
Joe Cullin 13:25 on 26 May 2005

Generated at 20:12 on 05 Jun 2005 by mariachi v0.52