Skip Menu |

This queue is for tickets about the Tie-Hash-Regex CPAN distribution.

Report information
The Basics
Id: 1346
Status: resolved
Priority: 0/
Queue: Tie-Hash-Regex

People
Owner: DAVECROSS [...] cpan.org
Requestors: mail [...] steffen-mueller.net
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 0.01
Fixed in: 0.08



Subject: EXISTS broken
This is about the current version of Tie::Hash::Regex - Tie-Hash-Regex-0.07. My perl is AS Perl 5.6.1 on w2k. It's a trivial bug, and I'll eat my shorts if it's platform dependant. Calling exists on the tied hashes results in a fatal error. The error lies in the EXISTS subroutine: Instead of the (blessed hashref) object, the subroutine tries to dereference the key ($key): "%$key" should become "%$self". I attached a patch as a file. It patches against the module and against the test.pl file to include a test that tests exists() on the tied hash. Thank you for your effort. Regards, Steffen Müller
--- Regex.pm Fri Jul 12 18:37:22 2002 +++ Regex_fixed.pm Thu Jul 25 14:58:44 2002 @@ -83,7 +83,7 @@ $key = qr/$key/ unless $is_re; - /$key/ && return 1 for keys %$key; + /$key/ && return 1 for keys %$self; return; } --- test.pl Sun Feb 17 07:39:04 2002 +++ test_fixed.pl Thu Jul 25 15:13:58 2002 @@ -1,7 +1,7 @@ # Before `make install' is performed this script should be runnable with # `make test'. After `make install' it should work as `perl test.pl' -use Test::Simple tests=> 8; +use Test::Simple tests=> 9; END {print "not ok 1\n" unless $loaded;} use Tie::Hash::Regex; @@ -31,6 +31,8 @@ ok(@vals == 2); delete $hash{f}; ok(keys %hash == 2); + +ok(exists $hash{key}); delete $hash{y}; ok(not keys %hash);