Remove an internal constant, _MOUSE_VERBOSE
[gitmo/Mouse.git] / lib / Mouse / Util.pm
index 187aa34..c941263 100644 (file)
@@ -3,6 +3,18 @@ use Mouse::Exporter; # enables strict and warnings
 
 sub get_linear_isa($;$); # must be here
 
+sub install_subroutines { # must be here
+    my $into = shift;
+
+    while(my($name, $code) = splice @_, 0, 2){
+        no strict 'refs';
+        no warnings 'once', 'redefine';
+        use warnings FATAL => 'uninitialized';
+        *{$into . '::' . $name} = \&{$code};
+    }
+    return;
+}
+
 BEGIN{
     # This is used in Mouse::PurePerl
     Mouse::Exporter->setup_import_methods(
@@ -48,6 +60,7 @@ BEGIN{
 
         (my $hack_mouse_file = __FILE__) =~ s/.Util//; # .../Mouse/Util.pm -> .../Mouse.pm
         $xs = eval sprintf("#line %d %s\n", __LINE__, $hack_mouse_file) . q{
+            local $^W = 0; # work around 'redefine' warning to &install_subroutines
             require XSLoader;
             XSLoader::load('Mouse', $VERSION);
             Mouse::Util->import({ into => 'Mouse::Meta::Method::Constructor::XS' }, ':meta');
@@ -68,8 +81,6 @@ BEGIN{
 use Carp         ();
 use Scalar::Util ();
 
-use constant _MOUSE_VERBOSE => !!$ENV{MOUSE_VERBOSE};
-
 # aliases as public APIs
 # it must be 'require', not 'use', because Mouse::Meta::Module depends on Mouse::Util
 require Mouse::Meta::Module; # for the entities of metaclass cache utilities