You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Stas Bekman <st...@stason.org> on 2005/05/25 19:12:22 UTC
Re: Mod Perl Code failures
[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@stason.org http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org http://ticketmaster.com
Re: Mod Perl Code failures
Posted by Joe Cullin <jc...@unipress.com>.
> > sub strip_end_data_segment {
> > - ${ +shift->{CODE} } =~ s/__(END|DATA)__(.*)//s;
> > + ${ +shift->{CODE} } =~ s/^__(END|DATA)__(.*)//ms;
> > }
> Sorry for the random, and probably naive question. What does the + in
> front of the shift do?
> --
> Regards,
> Iain
Check out "perldoc perlref" (search for "disambiguate"). Basically, the +
just makes sure that perl interprets the { in front of shift as a hash ref
and not as the start of a block of code.
-Joe
Re: Mod Perl Code failures
Posted by iain hubbard <ia...@ramesystravel.co.uk>.
On Wed, 2005-05-25 at 18:12, Stas Bekman wrote:
[snip]
> 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;
> }
>
Sorry for the random, and probably naive question. What does the + in
front of the shift do?
--
Regards,
Iain