Implemented Mouse::Role->does; modified Mouse::Meta::Class->initialise
[gitmo/Mouse.git] / lib / Mouse / Util.pm
index 53af4cf..8452299 100644 (file)
@@ -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;