develooper Front page | perl.perl5.porters | Postings from March 2006

Re: CLONE for Tie::RefHash

Thread Previous | Thread Next
From:
Rafael Garcia-Suarez
Date:
March 29, 2006 01:23
Subject:
Re: CLONE for Tie::RefHash
Message ID:
20060329112422.096b1af3@grubert.mandriva.com
Yuval Kogman wrote:
> Hi,
> 
> Tie::RefHash uses overload::StrVal to key the references internally.
> 
> On thread cloning this value changes.
> 
> Attached is a patch and a test to cause the reference keys to be
> reindexed on CLONE.

Your test doesn't pass with bleadperl (see output below).
(However the patch looks good at first glance.)

1..14
ok 1 - fetch by string before clone (foo)
ok 2 - fetch by ref before clone (HASH(0x82a2e0c))
ok 3 - fetch by ref before clone (ARRAY(0x83dd52c))
ok 4 - key count is OK
ok 5 - string key exists (foo)
ok 6 - fetch by string
not ok 7 - ref key exists (HASH(0x84acd14))
#   Failed test 'ref key exists (HASH(0x84acd14))'
#   in ../threaded.t at line 45.
not ok 8 - fetch by ref
#   Failed test 'fetch by ref'
#   in ../threaded.t at line 46.
#          got: undef
#     expected: 'hash'
not ok 9 - ref key exists (ARRAY(0x84acd64))
#   Failed test 'ref key exists (ARRAY(0x84acd64))'
#   in ../threaded.t at line 48.
not ok 10 - fetch by ref
#   Failed test 'fetch by ref'
#   in ../threaded.t at line 49.
#          got: undef
#     expected: 'array'
ok 11 - keys are ok
ok 12 - fetch by string after clone, orig thread (foo)
ok 13 - fetch by ref after clone (HASH(0x82a2e0c))
ok 14 - fetch by ref after clone (ARRAY(0x83dd52c))
# Looks like you failed 4 tests of 14.

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About