Now handles => qr/regex/ is supported
[gitmo/Mouse.git] / lib / Mouse / Util.pm
index 8d4eadb..34f6eee 100644 (file)
@@ -1,11 +1,13 @@
 package Mouse::Util;
 use Mouse::Exporter; # enables strict and warnings
 
+sub get_linear_isa($;$); # must be here
+
 BEGIN{
     # Because Mouse::Util is loaded first in all the Mouse sub-modules,
     # XS loader is placed here, not in Mouse.pm.
 
-    our $VERSION = '0.40_04';
+    our $VERSION = '0.40_06';
 
     my $xs = !(exists $INC{'Mouse/PurePerl.pm'} || $ENV{MOUSE_PUREPERL});
 
@@ -101,10 +103,10 @@ sub does_role{
 }
 
 BEGIN {
-    my $impl;
+    my $get_linear_isa;
     if ($] >= 5.009_005) {
         require mro;
-        $impl = \&mro::get_linear_isa;
+        $get_linear_isa = \&mro::get_linear_isa;
     } else {
         my $e = do {
             local $@;
@@ -112,11 +114,11 @@ BEGIN {
             $@;
         };
         if (!$e) {
-            $impl = \&mro::get_linear_isa;
+            $get_linear_isa = \&mro::get_linear_isa;
         } else {
 #       VVVVV   CODE TAKEN FROM MRO::COMPAT   VVVVV
             my $_get_linear_isa_dfs; # this recurses so it isn't pretty
-            $_get_linear_isa_dfs = sub {
+            $_get_linear_isa_dfs = sub ($;$){
                 no strict 'refs';
 
                 my $classname = shift;
@@ -134,13 +136,11 @@ BEGIN {
                 return \@lin;
             };
 #       ^^^^^   CODE TAKEN FROM MRO::COMPAT   ^^^^^
-            $impl = $_get_linear_isa_dfs;
+            $get_linear_isa = $_get_linear_isa_dfs;
         }
     }
 
-
-    no warnings 'once';
-    *get_linear_isa = $impl;
+    *get_linear_isa = $get_linear_isa;
 }
 
 
@@ -183,7 +183,7 @@ sub is_valid_class_name {
     return 0 if ref($class);
     return 0 unless defined($class);
 
-    return 1 if $class =~ /^\w+(?:::\w+)*$/;
+    return 1 if $class =~ /\A \w+ (?: :: \w+ )* \z/xms;
 
     return 0;
 }
@@ -336,7 +336,7 @@ Mouse::Util - Features, with or without their dependencies
 
 =head1 VERSION
 
-This document describes Mouse version 0.40_04
+This document describes Mouse version 0.40_06
 
 =head1 IMPLEMENTATIONS FOR