Return-Path: Delivered-To: apmail-perl-dev-archive@perl.apache.org Received: (qmail 15026 invoked by uid 500); 26 May 2003 07:46:50 -0000 Mailing-List: contact dev-help@perl.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: list-post: Delivered-To: mailing list dev@perl.apache.org Received: (qmail 15011 invoked from network); 26 May 2003 07:46:50 -0000 Received: from erato.logilune.com (HELO mail.logilune.com) (195.154.174.52) by daedalus.apache.org with SMTP; 26 May 2003 07:46:50 -0000 Received: from stason.org (localhost.logilune.com [127.0.0.1]) by mail.logilune.com (Postfix) with ESMTP id 83C5479B82 for ; Mon, 26 May 2003 09:47:00 +0200 (CEST) Message-ID: <3ED1C66A.2080004@stason.org> Date: Mon, 26 May 2003 17:46:50 +1000 From: Stas Bekman Organization: Hope, Humanized User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.1) Gecko/20020826 X-Accept-Language: en-us, en MIME-Version: 1.0 To: dev@perl.apache.org Subject: [patch] shutting down 'constant sub redefined' in Apache::Reload Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N Currently if you have used a constant sub in your code, Apache::Reload will complain every time the code is reloaded. And for a good reason: http://groups.google.com/groups?threadm=20020519214851.3981.qmail%40airtrout.tregar.com http://archive.develooper.com/perl5-changes%40perl.org/msg04919.html However it's a bad thing not being able to shut those warning, if you know that you didn't modify the constant subs. The approach suggested by Rafael is to use $SIG{__WARN__} override, only for those who know what they are doing: PerlSetVar ReloadNoWarningsConstantRedefine on here is the patch. Not sure if that variable is not too long... may be shouldn't use reverse logic but: PerlSetVar ReloadWarningsConstantRedefine off with 'on' being the default. better name suggestions are welcome as well. Index: lib/Apache/Reload.pm =================================================================== RCS file: /home/cvs/modperl-2.0/lib/Apache/Reload.pm,v retrieving revision 1.10 diff -u -r1.10 Reload.pm --- lib/Apache/Reload.pm 8 May 2003 00:31:27 -0000 1.10 +++ lib/Apache/Reload.pm 26 May 2003 07:38:31 -0000 @@ -63,6 +63,9 @@ my $TouchFile = ref($o) && $o->dir_config("ReloadTouchFile"); + my $NoWarningsConstantRedefine = ref($o) && + (lc($o->dir_config("ReloadNoWarningsConstantRedefine") || '') eq 'on');; + my $TouchModules; if ($TouchFile) { @@ -141,6 +144,8 @@ undef %{$symref}; } no warnings FATAL => 'all'; + local $SIG{__WARN__} = \&skip_redefine_const_sub_warn + if $NoWarningsConstantRedefine; require $key; warn("Apache::Reload: process $$ reloading $key\n") if $DEBUG; @@ -149,6 +154,11 @@ } return Apache::OK; +} + +sub skip_redefine_const_sub_warn { + return if $_[0] =~ /^Constant subroutine [\w:]+ redefined at/; + CORE::warn(@_); } 1; __________________________________________________________________ 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 --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org For additional commands, e-mail: dev-help@perl.apache.org