Turns on FATAL => 'recursion' by "use Mouse"
gfx [Wed, 10 Mar 2010 10:41:06 +0000 (19:41 +0900)]
Changes
lib/Mouse/Exporter.pm
lib/Mouse/Meta/Method/Accessor.pm

diff --git a/Changes b/Changes
index 75bc25e..63153c6 100644 (file)
--- a/Changes
+++ b/Changes
@@ -1,6 +1,8 @@
 Revision history for Mouse
 
 0.50_08
+    * Mouse::Exporter
+        - Turns on warnings FATAL => 'recursion' by default (gfx)
     * Mouse::Util::TypeConstraints
         - Change the type parser to check syntax (gfx)
           (Now it throws erros to "ArrayRef[]", "ArrayRef[Int", etc.)
index 4b32879..3fa046a 100644 (file)
@@ -9,13 +9,19 @@ my %SPEC;
 my $strict_bits;
 BEGIN{ $strict_bits = strict::bits(qw(subs refs vars)); }
 
+my $warnings_extra_bits;
+BEGIN{ $warnings_extra_bits = warnings::bits(FATAL => 'recursion') }
+
 # it must be "require", because Mouse::Util depends on Mouse::Exporter,
 # which depends on Mouse::Util::import()
 require Mouse::Util;
 
 sub import{
-    $^H              |= $strict_bits;         # strict->import;
-    ${^WARNING_BITS} |= $warnings::Bits{all}; # warnings->import;
+    # strict->import;
+    $^H              |= $strict_bits;
+    # warnings->import('all', FATAL => 'recursion');
+    ${^WARNING_BITS} |= $warnings::Bits{all};
+    ${^WARNING_BITS} |= $warnings_extra_bits;
     return;
 }
 
@@ -168,8 +174,10 @@ sub do_import {
         }
     }
 
-    $^H              |= $strict_bits;         # strict->import;
-    ${^WARNING_BITS} |= $warnings::Bits{all}; # warnings->import;
+    $^H              |= $strict_bits;                                 # strict->import;
+    # warnings->import('all', FATAL => 'recursion');
+    ${^WARNING_BITS} |= $warnings::Bits{all};
+    ${^WARNING_BITS} |= $warnings_extra_bits;
 
     if($spec->{INIT_META}){
         my $meta;
index 350e3e2..5ec165f 100755 (executable)
@@ -1,7 +1,5 @@
 package Mouse::Meta::Method::Accessor;
 use Mouse::Util qw(:meta); # enables strict and warnings
-use warnings FATAL => 'recursion';
-
 
 sub _inline_slot{
     my(undef, $self_var, $attr_name) = @_;