Toby Inkster avatar Toby Inkster committed 61667bd

drop old object_id method

Comments (0)

Files changed (5)

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 ] };

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;
 	].
 $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');
 $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');
 
 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;
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.