From: gfx Date: Wed, 10 Mar 2010 10:41:06 +0000 (+0900) Subject: Turns on FATAL => 'recursion' by "use Mouse" X-Git-Tag: 0.50_08~1 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=8a3fa3491887dde3e04e2d0bf5e91cebc72bf036;p=gitmo%2FMouse.git Turns on FATAL => 'recursion' by "use Mouse" --- diff --git a/Changes b/Changes index 75bc25e..63153c6 100644 --- 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.) diff --git a/lib/Mouse/Exporter.pm b/lib/Mouse/Exporter.pm index 4b32879..3fa046a 100644 --- a/lib/Mouse/Exporter.pm +++ b/lib/Mouse/Exporter.pm @@ -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; diff --git a/lib/Mouse/Meta/Method/Accessor.pm b/lib/Mouse/Meta/Method/Accessor.pm index 350e3e2..5ec165f 100755 --- a/lib/Mouse/Meta/Method/Accessor.pm +++ b/lib/Mouse/Meta/Method/Accessor.pm @@ -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) = @_;