From: Florian Ragwitz Date: Fri, 25 Feb 2011 17:30:18 +0000 (+0100) Subject: Upgrade Tie::RefHash from version 1.38 to 1.39 X-Git-Tag: v5.13.11~436 X-Git-Url: https://perl5.git.perl.org/perl5.git/commitdiff_plain/c34a735eb8190cd7cf9d4956d849b2f0d91d397d?ds=sidebyside Upgrade Tie::RefHash from version 1.38 to 1.39 --- diff --git a/Porting/Maintainers.pl b/Porting/Maintainers.pl index ced1074..214018d 100755 --- a/Porting/Maintainers.pl +++ b/Porting/Maintainers.pl @@ -1566,7 +1566,7 @@ use File::Glob qw(:case); 'Tie::RefHash' => { 'MAINTAINER' => 'nuffin', - 'DISTRIBUTION' => 'NUFFIN/Tie-RefHash-1.38.tar.gz', + 'DISTRIBUTION' => 'FLORA/Tie-RefHash-1.39.tar.gz', 'FILES' => q[cpan/Tie-RefHash], 'UPSTREAM' => 'cpan', }, diff --git a/cpan/Tie-RefHash/lib/Tie/RefHash.pm b/cpan/Tie-RefHash/lib/Tie/RefHash.pm index f95bf41..ed72abc 100644 --- a/cpan/Tie-RefHash/lib/Tie/RefHash.pm +++ b/cpan/Tie-RefHash/lib/Tie/RefHash.pm @@ -2,7 +2,7 @@ package Tie::RefHash; use vars qw/$VERSION/; -$VERSION = "1.38"; +$VERSION = "1.39"; use 5.005; @@ -71,6 +71,11 @@ cloning of tied refhashes. This version of Tie::RefHash seems to no longer work with 5.004. This has not been throughly investigated. Patches welcome ;-) +=head1 LICENSE + +This program is free software; you can redistribute it and/or modify it under +the same terms as Perl itself + =head1 MAINTAINER Yuval Kogman Enothingmuch@woobling.orgE @@ -159,7 +164,7 @@ my $storable_format_version = join("/", __PACKAGE__, "0.01"); sub STORABLE_freeze { my ( $self, $is_cloning ) = @_; my ( $refs, $reg ) = @$self; - return ( $storable_format_version, [ values %$refs ], $reg ); + return ( $storable_format_version, [ values %$refs ], $reg || {} ); } sub STORABLE_thaw { diff --git a/cpan/Tie-RefHash/t/storable.t b/cpan/Tie-RefHash/t/storable.t index 6c28b77..260622b 100644 --- a/cpan/Tie-RefHash/t/storable.t +++ b/cpan/Tie-RefHash/t/storable.t @@ -21,7 +21,7 @@ use Tie::RefHash; use Storable qw/dclone nfreeze thaw/; $\ = "\n"; -print "1..24"; +print "1..42"; sub ok ($$) { print ( ( $_[0] ? "" : "not " ), "ok - $_[1]" ); @@ -47,7 +47,7 @@ foreach my $clone ( \%hash, dclone(\%hash), thaw(nfreeze(\%hash)) ){ isa_ok( tied(%$clone), "Tie::RefHash" ); my @keys = keys %$clone; - is( scalar(@keys), 2, "one key in clone"); + is( scalar(@keys), 2, "two keys in clone"); my $key = ref($keys[0]) ? shift @keys : pop @keys; my $reg = $keys[0]; @@ -60,4 +60,21 @@ foreach my $clone ( \%hash, dclone(\%hash), thaw(nfreeze(\%hash)) ){ is( $clone->{$reg}, "other", "and is also a valid key" ); } +tie my %only_refs, "Tie::RefHash"; +$only_refs{$key} = "value"; + +foreach my $clone ( \%only_refs, dclone(\%only_refs), thaw(nfreeze(\%only_refs)) ){ + + ok( tied(%$clone), "copy is tied"); + isa_ok( tied(%$clone), "Tie::RefHash" ); + + my @keys = keys %$clone; + is( scalar(@keys), 1, "one key in clone"); + my $key = $keys[0]; + + ok( ref($key), "key is a ref after clone" ); + is( $key->{foo}, 1, "key serialized ok"); + + is( $clone->{$key}, "value", "and is still pointing at the same value" ); +} diff --git a/cpan/Tie-RefHash/t/threaded.t b/cpan/Tie-RefHash/t/threaded.t index 7e4fa1a..8767f97 100644 --- a/cpan/Tie-RefHash/t/threaded.t +++ b/cpan/Tie-RefHash/t/threaded.t @@ -21,7 +21,7 @@ BEGIN { } if ( $Config{usethreads} and !$Config{use5005threads} and defined(&Scalar::Util::weaken) - and eval { require threads; "threads"->import } + and eval { require threads; threads->import; 1 } ) { print "1..14\n"; } else { diff --git a/pod/perldelta.pod b/pod/perldelta.pod index e88e0e5..a0d61d4 100644 --- a/pod/perldelta.pod +++ b/pod/perldelta.pod @@ -114,6 +114,10 @@ C has been upgraded from version 3.22 to 3.23 C has been upgraded from version 0.97_01 to 0.98 +=item * + +C has been upgraded from version 1.38 to 1.39. + =back =head2 Removed Modules and Pragmata