Skip to content

Commit

Permalink
fix #40, #41
Browse files Browse the repository at this point in the history
  • Loading branch information
gfx committed Apr 12, 2015
1 parent 3eb4f9f commit 9a25259
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 20 deletions.
2 changes: 2 additions & 0 deletions Changes
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
Revision history for Mouse

{{$NEXT}}
- Fixed #40; 'use strict' not enabled when 'use 5.010' follows 'use Mouse'
- Fixed #39; New warnings in Perl 5.21.x: redundant arguments for sprintf
- Fixed #38; Avoid warnings introduced in Perl 5.21.x
- Fixed #36; Excess dependency on Test::Exception::LessClever (kentnl, #37)

Expand Down
23 changes: 4 additions & 19 deletions lib/Mouse/Exporter.pm
Original file line number Diff line number Diff line change
Expand Up @@ -5,25 +5,13 @@ use Carp ();

my %SPEC;

my $strict_bits;
my $warnings_extra_bits;
BEGIN{
$strict_bits = strict::bits(qw(subs refs vars));
$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{
## no critic ProhibitBitwiseOperators

# strict->import;
$^H |= $strict_bits;
# warnings->import('all', FATAL => 'recursion');
${^WARNING_BITS} |= $warnings::Bits{all};
${^WARNING_BITS} |= $warnings_extra_bits;
strict->import;
warnings->import('all', FATAL => 'recursion');
return;
}

Expand Down Expand Up @@ -170,11 +158,8 @@ sub do_import {
}
}

# strict->import;
$^H |= $strict_bits; ## no critic ProhibitBitwiseOperators
# warnings->import('all', FATAL => 'recursion');
${^WARNING_BITS} |= $warnings::Bits{all}; ## no critic ProhibitBitwiseOperators
${^WARNING_BITS} |= $warnings_extra_bits; ## no critic ProhibitBitwiseOperators
strict->import;
warnings->import('all', FATAL => 'recursion');

if($spec->{INIT_META}){
my $meta;
Expand Down
2 changes: 1 addition & 1 deletion t/strictures-fail.t → t/900_mouse_bugs/018_issue41.t
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use Test::More;

eval 'sub bar { $x = 1 ; return $x }';
::ok($@, '... got an error because strict is on');
::like($@, qr/Global symbol \"\$foo\" requires explicit package name/, '... got the right error');
::like($@, qr/Global symbol \"\$x\" requires explicit package name/, '... got the right error');

}

Expand Down

0 comments on commit 9a25259

Please sign in to comment.