From: Dave Rolsky Date: Sun, 4 Jul 2010 15:54:01 +0000 (-0500) Subject: Revert the change that unimported strict & warnings on no Moose(::Role,::Exporter) X-Git-Tag: 1.09~70 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=aee0741bbed3076af07a989bd8fb2362cc1d4711;p=gitmo%2FMoose.git Revert the change that unimported strict & warnings on no Moose(::Role,::Exporter) --- diff --git a/Changes b/Changes index 72e4ee8..d0bef14 100644 --- a/Changes +++ b/Changes @@ -1,6 +1,15 @@ Also see Moose::Manual::Delta for more details of, and workarounds for, noteworthy changes. + [NEW FEATURES] + + * We no longer unimport strict and warnings when Moose, Moose::Role, or + Moose::Exporter are unimported. Doing this was broken if the user + explicitly loaded strict and warnings themself, and the results could be + generally surprising. We decided that it was best to err on the side of + safety and leave these on. Reported by David Wheeler. RT #58310. (Dave + Rolsky) + [BUG FIXES] * Accessors will now not be inlined if the instance metaclass isn't diff --git a/lib/Moose/Exporter.pm b/lib/Moose/Exporter.pm index 717b732..8ed1de3 100644 --- a/lib/Moose/Exporter.pm +++ b/lib/Moose/Exporter.pm @@ -475,8 +475,6 @@ sub _make_unimport_sub { $export_recorder, $is_reexport, ); - strict->unimport; - warnings->unimport; }; } @@ -569,11 +567,6 @@ sub import { warnings->import; } -sub unimport { - strict->unimport; - warnings->unimport; -} - 1; __END__ diff --git a/lib/Moose/Manual/Delta.pod b/lib/Moose/Manual/Delta.pod index fe1ad95..93fd31b 100644 --- a/lib/Moose/Manual/Delta.pod +++ b/lib/Moose/Manual/Delta.pod @@ -16,6 +16,14 @@ feature. If you encounter a problem and have a solution but don't see it documented here, or think we missed an important feature, please send us a patch. +=head1 1.09 + +=item C, C, and C no longer unimport strict and warnings + +This change was made in 1.05, and has now been reverted. We don't know if the +user has explicitly loaded strict or warnings outside on their own, and +unimporting them is just broken in that case. + =head1 1.05 =over 4 diff --git a/t/010_basics/007_always_strict_warnings.t b/t/010_basics/007_always_strict_warnings.t index 454891e..a10d94a 100644 --- a/t/010_basics/007_always_strict_warnings.t +++ b/t/010_basics/007_always_strict_warnings.t @@ -22,22 +22,6 @@ use Test::More; ::ok($warn, '... got a warning'); ::like($warn, qr/Argument \"hello\" isn\'t numeric in addition \(\+\)/, '.. and it is the right warning'); } - - no Moose; - undef $@; - eval '$foo = 5;'; - ::ok(!$@, "... no error after no Moose"); - - { - my $warn; - local $SIG{__WARN__} = sub { $warn = $_[0] }; - - ::ok(!$warn, '... no warning yet'); - - eval 'my $bar = 1 + "hello"'; - - ::ok(!$warn, '... still no warning'); - } } # and for roles ... @@ -60,22 +44,6 @@ use Test::More; ::ok($warn, '... got a warning'); ::like($warn, qr/Argument \"hello\" isn\'t numeric in addition \(\+\)/, '.. and it is the right warning'); } - - no Moose::Role; - undef $@; - eval '$foo = 5;'; - ::ok(!$@, "... no error after no Moose::Role"); - - { - my $warn; - local $SIG{__WARN__} = sub { $warn = $_[0] }; - - ::ok(!$warn, '... no warning yet'); - - eval 'my $bar = 1 + "hello"'; - - ::ok(!$warn, '... still no warning'); - } } # and for exporters @@ -83,9 +51,9 @@ use Test::More; package Bar; use Moose::Exporter; - eval '$foo2 = 5;'; + eval '$foo = 5;'; ::ok($@, '... got an error because strict is on'); - ::like($@, qr/Global symbol \"\$foo2\" requires explicit package name at/, '... got the right error'); + ::like($@, qr/Global symbol \"\$foo\" requires explicit package name at/, '... got the right error'); { my $warn; @@ -98,22 +66,6 @@ use Test::More; ::ok($warn, '... got a warning'); ::like($warn, qr/Argument \"hello\" isn\'t numeric in addition \(\+\)/, '.. and it is the right warning'); } - - no Moose::Exporter; - undef $@; - eval '$foo = 5;'; - ::ok(!$@, "... no error after no Moose::Exporter"); - - { - my $warn; - local $SIG{__WARN__} = sub { $warn = $_[0] }; - - ::ok(!$warn, '... no warning yet'); - - eval 'my $bar = 1 + "hello"'; - - ::ok(!$warn, '... still no warning'); - } } done_testing; diff --git a/xt/author/pod_coverage.t b/xt/author/pod_coverage.t index 7544c2c..acfdff6 100644 --- a/xt/author/pod_coverage.t +++ b/xt/author/pod_coverage.t @@ -14,7 +14,6 @@ my @modules = all_modules(); plan tests => scalar @modules; my %trustme = ( - 'Moose::Exporter' => ['unimport'], 'Moose::Meta::Attribute' => [ qw( interpolate_class throw_error