Perrin Harkins wrote:
On Tue, 2003-05-27 at 16:28, Dale Lancaster wrote:

I have combed the various docs and haven't yet found the silver bullet
to turn off all the warnings I am getting from mod_perl in my
error_log that look something like this:

Constant subroutine
Apache::ROOTusa_2eusahire_2ecom::cgi_2dbin::portal::gojobs::gojobs_2ecgi::RC_CONTINUE 
redefined at /usr/lib/perl5/site_perl/5.8.0/i386-linux-thread-multi/Apache/PerlRun.pm 
line 361.

I have tried:

PerlWarn Off in the httpd.conf file

no warnings ; in the startup.pl
no strict ;     in the startup.pl


It should work to do this:
no warnings qw(redefine);

These are lexically scoped, so if your script has a use warnings or -w
in it, they will get turned back on.

This is not the case with constant subs. Perl 5.8.0+ provides no facilities to shut it off, on purpose. The only way to avoid these warnings is to install this trap:


$SIG{__WARN__} = \&skip_redefine_const_sub_warn;

sub skip_redefine_const_sub_warn {
    return if $_[0] =~ /^Constant subroutine [\w:]+ redefined at/;
    CORE::warn(@_);
}

I'm now fixing Apache::Reload to have a special config option to enable this feature. This can't be turned off by default, because it may result in unexpected behavior if the constant sub was modified for real. So a special option for those who know what are they doing will be provided.

Note that this only happens when you cause PerlRun to reload a script
that defines constants.  Restarting the server as described in the docs
avoids the issue:
http://perl.apache.org/docs/1.0/guide/troubleshooting.html#Constant_subroutine_XXX_redefined

I'll update this section with the above info.


__________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com



Reply via email to