You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Bart van Kuik <b....@sron.nl> on 2006/10/20 19:00:12 UTC

Subroutine xxx redefined

Hi list,

I'm using Apache::PerlRun to run my Perl scripts. I'm getting the 
following error:

Subroutine xxx redefined at /path/to/sirq.pl line 100.
Subroutine xxy redefined at /path/to/sirq.pl line 200.
Subroutine xxz redefined at /path/to/sirq.pl line 300.

I can't find in the guide what I'm doing wrong.

Some version info:
Slackware Linux 10.1 with a custom compiled Apache/1.3.33 and 
mod_perl/1.29. Perl version 5.8.6.

Piece of httpd.conf for the directory concerned:

<Directory /home/*/public_html>
     Options MultiViews Indexes FollowSymlinks ExecCGI
     <Files *pl>
         SetHandler perl-script
         PerlHandler Apache::PerlRun
         Options ExecCGI FollowSymLinks
         allow from all
         PerlSendHeader On
     </Files>
</Directory>

Thanks,
Bart

Re: Subroutine xxx redefined

Posted by Perrin Harkins <pe...@elem.com>.
On Tue, 2006-10-24 at 09:43 +0200, Bart van Kuik wrote:
> The before-mentioned piece of script gives the following warning:
> Subroutine testsub redefined at /home/bartvk/public_html/tscu/test.pl 
> line 7.

The same every time?  That's very strange.  I'd start adding some debug
statements to Apache::PerlRun to make sure it really is handling this
script.  In particular, I'd put some warnings in the flush_namespace()
sub to see if it is trying to clear out that sub or not.

One possible explanation for this behavior is that something which did
not warn in older versions of perl (when it was more likely to be
running mod_perl 1 and Apache::PerlRun) now does.  In that case, it
should be possible to patch PerlRun to suppress the warning.  But first,
make sure PerlRun is really running your script and clearing the symbol
table afterward.

> Clicking on the module name gives a screen with a list of functions; I 
> don't really see how to get more information on PerlRun.

Apologies, it shows a lot more detail for Apache::Registry but not for
PerlRun.  You can browse the symbol table of loaded packages though, I
believe, which would include the package generated for your script.

- Perrin


Re: Subroutine xxx redefined

Posted by Bart van Kuik <b....@sron.nl>.
Perrin Harkins wrote:
>> Anyway, it happens with every reload of the page except the first load 
>> (after the webserver is restarted). Is this something typical of using
>> "PerlHandler Apache::PerlRun"?
> Are you doing something with virtual hosts?

No.

> Apache::PerlRun is supposed to clear out the whole namespace of that
> script each time.  Maybe it would help if you showed the exact errors
> you're getting, rather than paraphrasing them.  Also, if you load

The before-mentioned piece of script gives the following warning:
Subroutine testsub redefined at /home/bartvk/public_html/tscu/test.pl 
line 7.

> Apache::Status, it will let you see what's going on with PerlRun.


I installed this module, went to the main screen -> Loaded Modules. For 
Apache::PerlRun, it says:

Apache::PerlRun	0.00	Sat Mar 8 03:11:09 2003 
/home/apache_mod_perl/lib/perl5/site_perl/5.8.6/i486-linux/Apache/PerlRun.pm

Clicking on the module name gives a screen with a list of functions; I 
don't really see how to get more information on PerlRun.

Thanks,
Bart