X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=gitmo%2FMouse.git;a=blobdiff_plain;f=lib%2FMouse%2FUtil.pm;h=8452299080eb08ec068b786240fafef6dec60875;hp=53af4cfd9778d92690774bc86df58814c930056c;hb=6719984210754e8d012ae678536f194c35000823;hpb=56a558f97f2da37b37db51a6a8ef7f923e84724e 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;