perl-modperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Thomas Wittek <m...@gedankenkonstrukt.de>
Subject Problems with __DATA__ within a module/handler and mod_perl2 (Own handler - NO CGI script) - Bug?
Date Sun, 17 Sep 2006 11:56:22 GMT
Hello!

I guess I've found a bug in mod_perl2. But I'd like to ask the users
list first, if anyone has an idea what goes wrong.

I've run into troubles accessing the __DATA__ section of my
modules/handlers. A minimal demonstration handler looks like this:

 #!/usr/bin/perl
 package TestHandler;
 sub handler {
   warn tell DATA;
   warn <DATA>;
   return 0;
 }
 1;
 __DATA__
 foo
 bar
 baz

(On the first run) It will correctly put this into the server log:

 121 at [..]/TestHandler.pm line 5.
 foo
 bar
 baz

But when I preload this module using the Apache directive

 PerlRequire /some/preload_script.pl

which contains:

 use TestHandler;

The cursor on the DATA filehandle will be wrong:

 133 at /usr/local/lib/perl/5.8.7/TestHandler.pm line 5.
 Warning: something's wrong at [..]/TestHandler.pm line 6.

In this case the cursor is positioned at the end of the file (which has
a length of 133 bytes). In other, larger modules the cursor sometimes is
positioned somewhere in the middle of the DATA section.

I don't think that this is the intended behaviour.

It works fine when not preloading the module. It also works fine on
Apache1/mod_perl1.

Any ideas?

Thanks!
-Thomas


Mime
View raw message