New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Tie::RefHash DELETE does not return value for ref keys #7565
Comments
From @nothingmuchCreated by @nothingmuchL<perlfunc/delete> documents delete as returning the value of the deleted key. Given <<TEST use Test::More tests => 5; use_ok('Tie::RefHash'); tie my %hash, 'Tie::RefHash'; $hash{blah} = "poot"; my $var = "oink"; $hash{$ref} = "ding"; test 5 fails, saying that ARRAY(0xdecaf) isn't 'ding' <<PATCH Inline Patch--- RefHash.pm~ Tue Aug 10 11:14:00 2004
+++ RefHash.pm Thu Oct 28 12:22:00 2004
@@ -115,7 +115,7 @@
sub DELETE {
my($s, $k) = @_;
- (ref $k) ? delete($s->[0]{overload::StrVal($k)}) : delete($s->[1]{$k});
+ (ref $k) ? delete($s->[0]{overload::StrVal($k)})->[1] : delete($s->[1]{$k});
}
sub EXISTS {
In Tie::RefHash CORE::delete is used to remove an array reference, that stores The value returned by the delete is the array reference. The patch thus dereferences the value returned from CORE::delete as an ARRAY, Ciao! Perl Info
|
From @nothingmuchHmm... Oddly, delete()->[1] sometimes dies saying that undef is not an array reference, but if I say sub DELETE { the problem goes away. |
@nothingmuch - Status changed from 'new' to 'open' |
From @rgsYuval Kojman (via RT) wrote:
Thanks, applied as change #24001 to bleadperl.
|
@rgs - Status changed from 'open' to 'resolved' |
Migrated from rt.perl.org#32193 (status was 'resolved')
Searchable as RT32193$
The text was updated successfully, but these errors were encountered: