diff options
author | Len Weisberg <unknown> | 2006-04-28 13:36:05 -0700 |
---|---|---|
committer | Rafael Garcia-Suarez <rgarciasuarez@gmail.com> | 2006-11-15 15:28:53 +0000 |
commit | 2c34a2756b22137a1d6a5e13c7147d4bb85aac16 (patch) | |
tree | c48419af7a88e8ea380ff947b3311d652ce9cb9e /lib/Tie | |
parent | 9c72c9db79f0d68bcad65d0b837f512e5a48992e (diff) | |
download | perl-2c34a2756b22137a1d6a5e13c7147d4bb85aac16.tar.gz |
[perl #39026] Tie::Memoize::EXISTS not caching the value
From: Len Weisberg (via RT) <perlbug-followup@perl.org>
Message-ID: <rt-3.0.11-39026-132847.17.5801704932685@perl.org>
p4raw-id: //depot/perl@29283
Diffstat (limited to 'lib/Tie')
-rw-r--r-- | lib/Tie/Memoize.pm | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/Tie/Memoize.pm b/lib/Tie/Memoize.pm index 2793a04590..dbe1442828 100644 --- a/lib/Tie/Memoize.pm +++ b/lib/Tie/Memoize.pm @@ -2,7 +2,7 @@ use strict; package Tie::Memoize; use Tie::Hash; our @ISA = 'Tie::ExtraHash'; -our $VERSION = '1.0'; +our $VERSION = '1.1'; our $exists_token = \undef; @@ -30,11 +30,11 @@ sub EXISTS { my $cache = $a->[1]{$key}; return $cache if defined $cache; # Existence cache my @res = $a->[3]($key,$a->[4]); - $_[0][1]{$key} = 0, return unless @res; # Cache non-existence + $a->[1]{$key} = 0, return unless @res; # Cache non-existence # Now we know it exists - return ($_[0][1]{$key} = 1) if $a->[5]; # Only existence reported + return ($a->[1]{$key} = 1) if $a->[5]; # Only existence reported # Now know the value - $_[0][0]{$key} = $res[0]; # Store data + $a->[0]{$key} = $res[0]; # Store data return 1 } |