In perl.git, the branch blead has been updated

<http://perl5.git.perl.org/perl.git/commitdiff/f7fd2659b1bc43d5ff74a8fdc3e6d30555d9aaff?hp=7064c127ddaf90b0127815f523631025a6ab49af>

- Log -----------------------------------------------------------------
commit f7fd2659b1bc43d5ff74a8fdc3e6d30555d9aaff
Author: Nicholas Clark <[email protected]>
Date:   Tue Aug 18 12:03:15 2009 +0100

    Flush the MRO cache at the end, rather than the start.
    
    Vincent notes that doing it at the start is fragile, as it assumes that the
    flush doesn't actively build any new caches, merely clear existing caches.
    Right now the flush only clears, but why rely on it when not doing so is 
easy?
-----------------------------------------------------------------------

Summary of changes:
 lib/constant.pm |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/lib/constant.pm b/lib/constant.pm
index 255aa99..69f16c5 100644
--- a/lib/constant.pm
+++ b/lib/constant.pm
@@ -45,7 +45,7 @@ sub import {
     my $constants;
     my $multiple  = ref $_[0];
     my $pkg = caller;
-    my $done_mro;
+    my $flush_mro;
     my $symtab;
 
     if (_CAN_PCS) {
@@ -124,8 +124,7 @@ sub import {
                    # constants from cv_const_sv are read only. So we have to:
                    Internals::SvREADONLY($scalar, 1);
                    $symtab->{$name} = \$scalar;
-                   # No need to flush the cache if we've just flushed it.
-                   mro::method_changed_in($pkg) unless $done_mro++;
+                   ++$flush_mro;
                } else {
                    *$full_name = sub () { $scalar };
                }
@@ -137,6 +136,8 @@ sub import {
            }
        }
     }
+    # Flush the cache exactly once if we make any direct symbol table changes.
+    mro::method_changed_in($pkg) if $flush_mro++;
 }
 
 1;

--
Perl5 Master Repository

Reply via email to