From: Father Chrysostomos Date: Sat, 10 Mar 2007 12:18:35 +0000 (-0800) Subject: [perl #41775] Memoize bug (and patch): problem with LIST_CACHE => MERGE X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=2fe79ddcb013d4ea51e6a1c875376da66337b28d;p=p5sagit%2Fp5-mst-13.2.git [perl #41775] Memoize bug (and patch): problem with LIST_CACHE => MERGE From: Father Chrysostomos (via RT) Message-ID: p4raw-id: //depot/perl@30729 --- diff --git a/lib/Memoize.pm b/lib/Memoize.pm index cf84542..f14a34a 100644 --- a/lib/Memoize.pm +++ b/lib/Memoize.pm @@ -11,7 +11,7 @@ # Version 1.01 $Revision: 1.18 $ $Date: 2001/06/24 17:16:47 $ package Memoize; -$VERSION = '1.01_01'; +$VERSION = '1.01_02'; # Compile-time constants sub SCALAR () { 0 } @@ -266,8 +266,9 @@ sub _memoizer { # Otherwise, we cached an array containing the returned list: return @$val; } else { - my $q = $cache->{$argstr} = [&{$info->{U}}(@_)]; - @$q; + my @q = &{$info->{U}}(@_); + $cache->{$argstr} = $info->{O}{LIST_CACHE} eq 'MERGE' ? $q [0] : \@q; + @q; } } else { croak "Internal error \#42; context was neither LIST nor SCALAR\n";