This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Upgrade Tie::RefHash from version 1.38 to 1.39
authorFlorian Ragwitz <rafl@debian.org>
Fri, 25 Feb 2011 17:30:18 +0000 (18:30 +0100)
committerFlorian Ragwitz <rafl@debian.org>
Fri, 25 Feb 2011 17:30:18 +0000 (18:30 +0100)
Porting/Maintainers.pl
cpan/Tie-RefHash/lib/Tie/RefHash.pm
cpan/Tie-RefHash/t/storable.t
cpan/Tie-RefHash/t/threaded.t
pod/perldelta.pod

index ced1074..214018d 100755 (executable)
@@ -1566,7 +1566,7 @@ use File::Glob qw(:case);
     'Tie::RefHash' =>
        {
        'MAINTAINER'    => 'nuffin',
     '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',
        },
        'FILES'         => q[cpan/Tie-RefHash],
        'UPSTREAM'      => 'cpan',
        },
index f95bf41..ed72abc 100644 (file)
@@ -2,7 +2,7 @@ package Tie::RefHash;
 
 use vars qw/$VERSION/;
 
 
 use vars qw/$VERSION/;
 
-$VERSION = "1.38";
+$VERSION = "1.39";
 
 use 5.005;
 
 
 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 ;-)
 
 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 E<lt>nothingmuch@woobling.orgE<gt>
 =head1 MAINTAINER
 
 Yuval Kogman E<lt>nothingmuch@woobling.orgE<gt>
@@ -159,7 +164,7 @@ my $storable_format_version = join("/", __PACKAGE__, "0.01");
 sub STORABLE_freeze {
   my ( $self, $is_cloning ) = @_;
   my ( $refs, $reg ) = @$self;
 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 {
 }
 
 sub STORABLE_thaw {
index 6c28b77..260622b 100644 (file)
@@ -21,7 +21,7 @@ use Tie::RefHash;
 use Storable qw/dclone nfreeze thaw/;
 
 $\ = "\n";
 use Storable qw/dclone nfreeze thaw/;
 
 $\ = "\n";
-print "1..24";
+print "1..42";
 
 sub ok ($$) {
     print ( ( $_[0] ? "" : "not " ), "ok - $_[1]" );
 
 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;
   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];
 
   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" );
 }
 
   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" );
+}
 
 
index 7e4fa1a..8767f97 100644 (file)
@@ -21,7 +21,7 @@ BEGIN {
   }
   if ( $Config{usethreads} and !$Config{use5005threads}
       and defined(&Scalar::Util::weaken)
   }
   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 {
   ) {
     print "1..14\n";
   } else {
index e88e0e5..a0d61d4 100644 (file)
@@ -114,6 +114,10 @@ C<Test::Harness> has been upgraded from version 3.22 to 3.23
 
 C<Test::Simple> has been upgraded from version 0.97_01 to 0.98
 
 
 C<Test::Simple> has been upgraded from version 0.97_01 to 0.98
 
+=item *
+
+C<Tie::RefHash> has been upgraded from version 1.38 to 1.39.
+
 =back
 
 =head2 Removed Modules and Pragmata
 =back
 
 =head2 Removed Modules and Pragmata