X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FClass%2FAccessor%2FGrouped.pm;h=b0b75ee82de36138e6b2b2c6c381cc3dcb4f653f;hb=2d392af1722569c5e7be42d3b0987fd72e070b5c;hp=fa83694ccf365e8d07a5c0c969962df4e8097fd7;hpb=d93670a50af4b85d84c9e7b2c4528eae6457dd47;p=p5sagit%2FClass-Accessor-Grouped.git diff --git a/lib/Class/Accessor/Grouped.pm b/lib/Class/Accessor/Grouped.pm index fa83694..b0b75ee 100644 --- a/lib/Class/Accessor/Grouped.pm +++ b/lib/Class/Accessor/Grouped.pm @@ -646,24 +646,25 @@ $gen_accessor = sub { die sprintf( "Class::XSAccessor requested but not available:\n%s\n", __CAG_NO_CXSA ) if __CAG_NO_CXSA; - my %deferred_calls_seen; - return sub { my $current_class = Scalar::Util::blessed( $_[0] ) || $_[0]; if (__CAG_TRACK_UNDEFER_FAIL) { + my $deferred_calls_seen = do { + no strict 'refs'; + \%{"${current_class}::__cag_deferred_xs_shim_invocations"} + }; my @cframe = caller(0); - if ($deferred_calls_seen{$current_class}{$cframe[3]}) { + if (my $already_seen = $deferred_calls_seen->{$cframe[3]}) { Carp::carp ( "Deferred version of method $cframe[3] invoked more than once (originally " - . "invoked at $deferred_calls_seen{$current_class}{$cframe[3]}). This is a strong " - . 'indication your code has cached the original ->can derived method coderef, ' - . 'and is using it instead of the proper method re-lookup, causing performance ' - . 'regressions' + . "invoked at $already_seen). This is a strong indication your code has " + . 'cached the original ->can derived method coderef, and is using it instead ' + . 'of the proper method re-lookup, causing performance regressions' ); } else { - $deferred_calls_seen{$current_class}{$cframe[3]} = "$cframe[1] line $cframe[2]"; + $deferred_calls_seen->{$cframe[3]} = "$cframe[1] line $cframe[2]"; } }