perl-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stas Bekman <s...@stason.org>
Subject [patch] noedit warnings cache removal
Date Tue, 04 Dec 2001 06:21:41 GMT
Currently if there are two calls to generate noedit warnings from the same
package, only the first call will produce the correct info. I guess that's
because when I've added tracing I didn't remove the caching feature.

So this patch removes the caching of the noedit preamble and generates a
fresh noedit header + trace for each invocation.

Index: lib/Apache/Build.pm
===================================================================
RCS file: /home/cvs/modperl-2.0/lib/Apache/Build.pm,v
retrieving revision 1.74
diff -u -r1.74 Build.pm
--- lib/Apache/Build.pm	2001/11/22 03:46:47	1.74
+++ lib/Apache/Build.pm	2001/12/04 05:59:04
@@ -417,11 +417,8 @@
     chmod 0755, $file;
 }

-my $noedit_warning_hash;
-
 sub noedit_warning_hash {
-    $noedit_warning_hash ||=
-      ModPerl::Code::noedit_warning_hash(__PACKAGE__);
+    ModPerl::Code::noedit_warning_hash(__PACKAGE__);
 }

 sub save {
Index: lib/ModPerl/Code.pm
===================================================================
RCS file: /home/cvs/modperl-2.0/lib/ModPerl/Code.pm,v
retrieving revision 1.72
diff -u -r1.72 Code.pm
--- lib/ModPerl/Code.pm	2001/11/24 01:15:01	1.72
+++ lib/ModPerl/Code.pm	2001/12/04 05:59:04
@@ -555,8 +555,6 @@
     [(map { "$_.c" } @c_names), (map { "$_.h" } @h_names)];
 }

-my %warnings;
-
 sub classname {
     my $self = shift || __PACKAGE__;
     ref($self) || $self;
@@ -564,12 +562,11 @@

 sub noedit_warning_c {
     my $class = classname(shift);
-    my $warning = \$warnings{C}->{$class};
-    return $$warning if $$warning;
+
     my $v = join '/', $class, $class->VERSION;
     my $trace = Apache::TestConfig::calls_trace();
     $trace =~ s/^/ * /mg;
-    $$warning = <<EOF;
+    return <<EOF;

 /*
  * *********** WARNING **************
@@ -586,10 +583,9 @@
 #non-Perl files, e.g. Makefile, typemap, etc.
 sub noedit_warning_hash {
     my $class = classname(shift);
-    my $warning = \$warnings{hash}->{$class};
-    return $$warning if $$warning;
-    ($$warning = noedit_warning_c($class)) =~ s/^/\# /mg;
-    $$warning;
+
+    (my $warning = noedit_warning_c($class)) =~ s/^/\# /mg;
+    return $warning;
 }

 sub init_file {


_____________________________________________________________________
Stas Bekman             JAm_pH      --   Just Another mod_perl Hacker
http://stason.org/      mod_perl Guide   http://perl.apache.org/guide
mailto:stas@stason.org  http://ticketmaster.com http://apacheweek.com
http://singlesheaven.com http://perl.apache.org http://perlmonth.com/


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
For additional commands, e-mail: dev-help@perl.apache.org


Mime
View raw message