An object method providing a unique identifier
use v5.14; package Person 1.0 { use Moo; use Role::Commons -all; has name => (is => 'ro'); }; my $bob1 = Person->new(name => "Bob"); my $bob2 = Person->new(name => "Bob"); say $bob1->object_id; # an identifier say $bob2->object_id; # a different identifier
This is a tiny shim between Object::ID and Role::Commons (and hence Moo::Role/Moose::Role too).
Please report any bugs to http://rt.cpan.org/Dist/Display.html?Queue=Role-Commons <http://rt.cpan.org/Dist/Display.html?Queue=Role-Commons>.
Role::Commons, Object::ID.
Toby Inkster <[email protected]>.
This software is copyright (c) 2012 by Toby Inkster.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
\s-1THIS\s0 \s-1PACKAGE\s0 \s-1IS\s0 \s-1PROVIDED\s0 \*(L"\s-1AS\s0 \s-1IS\s0\*(R" \s-1AND\s0 \s-1WITHOUT\s0 \s-1ANY\s0 \s-1EXPRESS\s0 \s-1OR\s0 \s-1IMPLIED\s0 \s-1WARRANTIES\s0, \s-1INCLUDING\s0, \s-1WITHOUT\s0 \s-1LIMITATION\s0, \s-1THE\s0 \s-1IMPLIED\s0 \s-1WARRANTIES\s0 \s-1OF\s0 \s-1MERCHANTIBILITY\s0 \s-1AND\s0 \s-1FITNESS\s0 \s-1FOR\s0 A \s-1PARTICULAR\s0 \s-1PURPOSE\s0.