diff options
| author | fukachan <fukachan> | 2001-08-21 10:04:10 +0000 |
|---|---|---|
| committer | fukachan <fukachan> | 2001-08-21 10:04:10 +0000 |
| commit | c45c3556b6f2fa709b86a75ddbc3cd8fe770dcf3 (patch) | |
| tree | c3e70feb8f09278c59ee333e591dd192b5f3a508 /fml/lib/Tie/JournaledFile.pm | |
| parent | 14c1ea935ff7046cf2a37e03816589e1606a398a (diff) | |
| download | fml8-c45c3556b6f2fa709b86a75ddbc3cd8fe770dcf3.tar.gz fml8-c45c3556b6f2fa709b86a75ddbc3cd8fe770dcf3.tar.bz2 fml8-c45c3556b6f2fa709b86a75ddbc3cd8fe770dcf3.zip | |
bug fix: hold return value separetely
Diffstat (limited to 'fml/lib/Tie/JournaledFile.pm')
| -rw-r--r-- | fml/lib/Tie/JournaledFile.pm | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/fml/lib/Tie/JournaledFile.pm b/fml/lib/Tie/JournaledFile.pm index f7ade087..8558cc53 100644 --- a/fml/lib/Tie/JournaledFile.pm +++ b/fml/lib/Tie/JournaledFile.pm @@ -4,7 +4,7 @@ # All rights reserved. This program is free software; you can # redistribute it and/or modify it under the same terms as Perl itself. # -# $FML: JournaledFile.pm,v 1.8 2001/08/21 03:46:39 fukachan Exp $ +# $FML: JournaledFile.pm,v 1.9 2001/08/21 08:37:04 fukachan Exp $ # package Tie::JournaledFile; @@ -242,7 +242,7 @@ sub _fetch unless (defined $fh) { return undef;} # o.k. we open cache file, here we go for searching - my ($xkey, $xvalue) = (); + my ($xkey, $xvalue, $value) = (); my (@values) = (); SEARCH: while (<$fh>) { @@ -255,8 +255,10 @@ sub _fetch ($xkey, $xvalue) = split(/\s+/, $_, 2); if ($xkey eq $key) { + $value = $xvalue; # save the value for $key + if ($mode eq 'array') { - push(@values, $xvalue); + push(@values, $value); } if ($mode eq 'scalar') { # firstmatch: exit loop ASAP if the $key is found. @@ -269,7 +271,7 @@ sub _fetch close($fh); if ($mode eq 'scalar') { - return( $xvalue || undef ); + return( $value || undef ); } elsif ($mode eq 'array') { return \@values; |
