Commits

Toby Inkster committed 61667bd

drop old object_id method

  • Participants
  • Parent commits 6915035

Comments (0)

Files changed (5)

File lib/MooX/Struct.pm

 }
 
 use Moo          1.000000;
-use Object::ID   0         qw( object_id );
+use Object::ID   0         qw(      );
 use Scalar::Does 0         qw( does );
 
 use overload
 
 METHODS: {
 	no warnings;
-	sub OBJECT_ID   { goto \&object_id };
+	sub OBJECT_ID   { goto \&Object::ID::object_id };
 	sub FIELDS      { qw() };
 	sub TYPE        { +undef };
 	sub TO_ARRAY    {  [ map {;       $_[0]->$_ } $_[0]->FIELDS ] };

File meta/changes.pret

 		item "Allow structs to consume roles using '-with' option."^^Addition;		
 		item "Constructor is now strict; it will croak if passed hash keys it doesn't recognise."^^Change;
 		item "New experimental method 'EXTEND'."^^Addition;
+		item "Dropped 'object_id' alias for 'OBJECT_ID'."^^Removal;
 	].

File t/02basicusage.t

 $acme->company_number(12345);
 is($acme->company_number, 12345, 'accessors can be made read-write');
 
-can_ok $alice => 'object_id';
-isnt($alice->object_id, $bob->object_id, 'object_id is unique identifier');
+can_ok $alice => 'OBJECT_ID';
+isnt($alice->OBJECT_ID, $bob->OBJECT_ID, 'OBJECT_ID is unique identifier');

File t/03inherit.t

 $acme->company_number(12345);
 is($acme->company_number, 12345, 'accessors can be made read-write');
 
-can_ok $alice => 'object_id';
-isnt($alice->object_id, $bob->object_id, 'object_id is unique identifier');
+can_ok $alice => 'OBJECT_ID';
+isnt($alice->OBJECT_ID, $bob->OBJECT_ID, 'OBJECT_ID is unique identifier');
 

File t/11extend.t

 use MooX::Struct Point => [qw( +x +y )];
 
 my $point = Point[];
+my $old_id = $point->OBJECT_ID;
 
 is($point->TYPE, 'Point');
 is_deeply([$point->FIELDS], ['x', 'y']);
 ok( $point->can('y'));
 ok( $point->can('z'));
 
+is($point->OBJECT_ID, $old_id, 'OBJECT_ID does not change during EXTEND');
 
 my $new = $point->CLONE(z => 0)->EXTEND(\"Point4D", '+w');
 is_deeply([$point->FIELDS], ['x', 'y', 'z']);
 is_deeply([$new->FIELDS], ['x', 'y', 'z', 'w']);
 
-done_testing;
+isnt($new->OBJECT_ID, $old_id, 'OBJECT_ID does change during CLONE+EXTEND');
+
+done_testing;