On Wed, 17 Jan 2001, Wenzhong Tang wrote:

> Since nobody seems care about this problem, I have to find a solution
> myself.  Fortunately perl has a "prototype" function that returns the
> prototype of a function.  Here is the difference between the original
> PerlRun.pm in mod_perl 1.24_01 and the updated one:

thanks for you patch, however this is not valid Perl syntax:

> >                 eval "\$mysub = sub {$proto} {}"; 

below is a different version, does it still quiet the warnings?

Index: lib/Apache/PerlRun.pm
===================================================================
RCS file: /home/cvs/modperl/lib/Apache/PerlRun.pm,v
retrieving revision 1.34
diff -u -r1.34 PerlRun.pm
--- lib/Apache/PerlRun.pm       2001/01/12 15:45:12     1.34
+++ lib/Apache/PerlRun.pm       2001/01/26 06:58:39
@@ -340,7 +340,12 @@
         if (defined &$fullname) {
             no warnings;
             local $^W = 0;
-            *{$fullname} = sub {};
+            if (my $p = prototype $fullname) {
+                eval "*{\$fullname}($p) = sub {}";
+            }
+            else {
+                *{$fullname} = sub {};
+            }
            undef &$fullname;
        }
         if (*{$fullname}{IO}) {

Reply via email to