X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FMouse%2FUtil.pm;h=8452299080eb08ec068b786240fafef6dec60875;hb=e693975ff1701c9d268c7cbde0fec816ce71305c;hp=53af4cfd9778d92690774bc86df58814c930056c;hpb=52c48ad7f7cf12cefee9c6e15ab00289976e342b;p=gitmo%2FMouse.git diff --git a/lib/Mouse/Util.pm b/lib/Mouse/Util.pm index 53af4cf..8452299 100644 --- a/lib/Mouse/Util.pm +++ b/lib/Mouse/Util.pm @@ -7,6 +7,9 @@ use Carp; our @EXPORT_OK = qw( get_linear_isa apply_all_roles + version + authority + identifier ); our %EXPORT_TAGS = ( all => \@EXPORT_OK, @@ -53,6 +56,20 @@ BEGIN { *{ __PACKAGE__ . '::get_linear_isa'} = $impl; } +{ # adapted from Class::MOP::Module + + sub version { no strict 'refs'; ${shift->name.'::VERSION'} } + sub authority { no strict 'refs'; ${shift->name.'::AUTHORITY'} } + sub identifier { + my $self = shift; + join '-' => ( + $self->name, + ($self->version || ()), + ($self->authority || ()), + ); + } +} + # taken from Class/MOP.pm { my %cache;