This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Update Object-Accessor to CPAN version 0.38
authorChris 'BinGOs' Williams <chris@bingosnet.co.uk>
Sat, 8 Jan 2011 23:09:04 +0000 (23:09 +0000)
committerChris 'BinGOs' Williams <chris@bingosnet.co.uk>
Sat, 8 Jan 2011 23:09:04 +0000 (23:09 +0000)
  [DELTA]

  Changes for 0.38    Fri Jan  7 21:47:51 GMT  2011
  =================================================
  * Apply blead patch from Peter Acklam

Porting/Maintainers.pl
cpan/Object-Accessor/lib/Object/Accessor.pm
cpan/Object-Accessor/t/06_Object-Accessor-alias.t
pod/perldelta.pod

index 30144ad..40b7a2e 100755 (executable)
@@ -1083,7 +1083,7 @@ use File::Glob qw(:case);
     'Object::Accessor' =>
        {
        'MAINTAINER'    => 'kane',
-       'DISTRIBUTION'  => 'BINGOS/Object-Accessor-0.36.tar.gz',
+       'DISTRIBUTION'  => 'BINGOS/Object-Accessor-0.38.tar.gz',
        'FILES'         => q[cpan/Object-Accessor],
        'UPSTREAM'      => 'cpan',
        },
index c943ee0..c7933ec 100644 (file)
@@ -10,7 +10,7 @@ use Data::Dumper;
 ### disable string overloading for callbacks
 require overload;
 
-$VERSION    = '0.36';
+$VERSION    = '0.38';
 $FATAL      = 0;
 $DEBUG      = 0;
 
index 2a8aa81..f302a09 100644 (file)
@@ -9,25 +9,48 @@ my $Class = 'Object::Accessor';
 
 use_ok($Class);
 
-my $Object      = $Class->new;
-my $Acc         = 'foo';
-my $Alias       = 'bar';
-
-### basic sanity test
-{   ok( $Object,                "Object created" );
-    
-    ok( $Object->mk_accessors( $Acc ),
-                                "   Accessor ->$Acc created" );
-    ok( $Object->$Acc( $$ ),    "   ->$Acc set to $$" );
+my $Object  = $Class->new;
+my $Acc     = 'foo';
+my $Alias   = 'bar';
+
+ok( $Object,                "Object created" );
+isa_ok( $Object, $Class,    "   Object" );
+
+### add an accessor
+{   my $rv = $Object->mk_accessors( $Acc );
+    ok( $rv,                "Created accessor '$Acc'" );
+    ok( $Object->$Acc( $$ ),"   Set value" );
+    is( $Object->$Acc, $$,  "   Retrieved value" );
+}
+
+### add an alias
+{   my $rv = $Object->mk_aliases( $Alias => $Acc );
+    ok( $rv,                "Created alias '$Alias'" );
+    ok( $Object->can( $Alias ),
+                            "   Alias '$Alias' exists" );
+    is( $Object->$Alias, $Object->$Acc,
+                            "   Alias & original return the same value" );
+
+    ok( $Object->$Alias( $$.$$ ),
+                            "   Changed value using alias" );
+    is( $Object->$Alias, $Object->$Acc,
+                            "   Alias & original return the same value" );
+}
+
+### test if cloning works
+{   my $clone = $Object->mk_clone;
+    ok( $clone,             "Cloned object" );
+
+    is_deeply( [sort $clone->ls_accessors], [sort $Object->ls_accessors],
+                            "   All accessors cloned" );
+
+    ok( $clone->$Acc( $$ ), "   Set value" );
+    is( $clone->$Alias, $clone->$Acc,
+                            "   Alias & original return the same value" );
+
+    ok( $clone->$Alias( $$.$$ ),
+                            "   Changed value using alias" );
+    is( $clone->$Alias, $clone->$Acc,
+                            "   Alias & original return the same value" );
 }
 
-### alias tests
-{   ok( $Object->mk_aliases( $Alias => $Acc ),
-                                "Alias ->$Alias => ->$Acc" );
-    ok( $Object->$Alias,        "   ->$Alias returns value" );
-    is( $Object->$Acc, $Object->$Alias,
-                                "       ->$Alias eq ->$Acc" );
-    ok( $Object->$Alias( $0 ),  "   Set value via alias ->$Alias" );                                  
-    is( $Object->$Acc, $Object->$Alias,
-                                "       ->$Alias eq ->$Acc" );
-}    
index 74a6321..4bed524 100644 (file)
@@ -148,6 +148,10 @@ C<Module::Load::Conditional> has been upgraded from 0.38 to 0.40
 
 =item *
 
+C<Object::Accessor> has been upgraded from 0.36 to 0.38
+
+=item *
+
 C<threads> has been upgraded from version 1.81_03 to 1.82
 
 =item *