Stas Bekman wrote:
David Radunz wrote:
Hi All,
I have looked high and low to work out how to avoid the 'Constant subroutine redefined' warnings in the error log, followed by the 'Prototype missmatch:' error upon subsequent hits to the apache child process - but, I have not been able to find an easy solution. The warnings are caused by the 'flush_namespace' routine of Apache::PerlRun which attempts to reset/nullify everything - including constants. When a constant is redefined it causes a warning in the error_log, and when the constant gets reset upon the next run of the script the prototype doesnt match as its reset incorrectly.
David, take a look at the ModPerl::PerlRun which now http://cvs.apache.org/viewcvs.cgi/modperl-2.0/ModPerl-Registry/lib/ModPerl/RegistryCooker.pm?r1=1.50&r2=1.51&diff_format=h
uses:
http://perl.apache.org/docs/2.0/api/ModPerl/Util.html#C_unload_package_
which Philippe has just added recently. (you will need the current mp2 cvs to see it at works). It solves all these problems in a much cleaner way. It's still too new to new to be sure that it doesn't have side-effects, but once it's proved to be good by users, we can just port it back to mp1.
It's also available as a yet to be released on CPAN module (Devel::Unload) here: http://svn.ectoplasm.org/projects/perl/Devel-Unload/
You might just try installing Devel::Unload and plugging it into PerlRun.pm and see if it works
(untested patch)
Index: lib/Apache/PerlRun.pm =================================================================== RCS file: /home/cvs/modperl/lib/Apache/PerlRun.pm,v retrieving revision 1.41 diff -u -I$Id -r1.41 PerlRun.pm --- lib/Apache/PerlRun.pm 8 Mar 2003 04:11:09 -0000 1.41 +++ lib/Apache/PerlRun.pm 8 Oct 2004 23:08:02 -0000 @@ -118,6 +118,8 @@ $_r->clear_rgy_endav; $_r->log_error("Apache::PerlRun->compile") if $Debug && $Debug & 4; Apache->untaint($$eval); + use Devel::Unload; + Devel::Unload::unload_package_xs($pr->namespace); { no strict; #so eval'd code doesn't inherit our bits eval $$eval;
If you want to look at the C code that does that, it's modperl_package_unload in:
http://cvs.apache.org/viewcvs.cgi/modperl-2.0/src/modules/perl/modperl_util.c?view=markup
signature.asc
Description: OpenPGP digital signature