From: Stevan Little Date: Tue, 23 May 2006 13:48:00 +0000 (+0000) Subject: foo X-Git-Tag: 0_09_03~15 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=c235cd988555d93242c6708ad021e3c439fca2db;p=gitmo%2FMoose.git foo --- diff --git a/lib/Moose.pm b/lib/Moose.pm index 91fe96e..2da321a 100644 --- a/lib/Moose.pm +++ b/lib/Moose.pm @@ -216,6 +216,9 @@ use Moose::Util::TypeConstraints; sub import { $CALLER = caller(); + + strict->import; + warnings->import; # we should never export to main return if $CALLER eq 'main'; diff --git a/lib/Moose/Role.pm b/lib/Moose/Role.pm index bee7fb9..048d003 100644 --- a/lib/Moose/Role.pm +++ b/lib/Moose/Role.pm @@ -149,6 +149,9 @@ use Moose::Util::TypeConstraints; sub import { $CALLER = caller(); + + strict->import; + warnings->import; # we should never export to main return if $CALLER eq 'main'; diff --git a/t/001_recipe.t b/t/001_recipe.t index 9fd1256..bb493b9 100644 --- a/t/001_recipe.t +++ b/t/001_recipe.t @@ -11,9 +11,7 @@ BEGIN { } { - package Point; - use strict; - use warnings; + package Point; use Moose; has 'x' => (isa => 'Int', is => 'ro'); @@ -26,8 +24,6 @@ BEGIN { } package Point3D; - use strict; - use warnings; use Moose; extends 'Point'; diff --git a/t/002_recipe.t b/t/002_recipe.t index 0e0b3ed..447db78 100644 --- a/t/002_recipe.t +++ b/t/002_recipe.t @@ -12,8 +12,6 @@ BEGIN { { package BankAccount; - use strict; - use warnings; use Moose; has 'balance' => (isa => 'Num', is => 'rw', default => 0); @@ -31,9 +29,7 @@ BEGIN { $self->balance($current_balance - $amount); } - package CheckingAccount; - use strict; - use warnings; + package CheckingAccount; use Moose; extends 'BankAccount'; diff --git a/t/003_recipe.t b/t/003_recipe.t index cdff83a..efe5327 100644 --- a/t/003_recipe.t +++ b/t/003_recipe.t @@ -14,8 +14,6 @@ BEGIN { { package BinaryTree; - use strict; - use warnings; use Moose; has 'node' => (is => 'rw', isa => 'Any'); diff --git a/t/004_recipe.t b/t/004_recipe.t index a3a36da..b80eaab 100644 --- a/t/004_recipe.t +++ b/t/004_recipe.t @@ -20,8 +20,6 @@ BEGIN { { package Address; - use strict; - use warnings; use Moose; use Moose::Util::TypeConstraints; @@ -48,8 +46,6 @@ BEGIN { has 'zip_code' => (is => 'rw', isa => 'USZipCode'); package Company; - use strict; - use warnings; use Moose; use Moose::Util::TypeConstraints; @@ -84,8 +80,6 @@ BEGIN { }; package Person; - use strict; - use warnings; use Moose; has 'first_name' => (is => 'rw', isa => 'Str', required => 1); @@ -101,8 +95,6 @@ BEGIN { } package Employee; - use strict; - use warnings; use Moose; extends 'Person'; diff --git a/t/005_recipe.t b/t/005_recipe.t index e3e6861..5736130 100644 --- a/t/005_recipe.t +++ b/t/005_recipe.t @@ -19,8 +19,6 @@ BEGIN { { package Request; - use strict; - use warnings; use Moose; use Moose::Util::TypeConstraints; diff --git a/t/006_recipe.t b/t/006_recipe.t index 514444b..5251f29 100644 --- a/t/006_recipe.t +++ b/t/006_recipe.t @@ -14,8 +14,6 @@ BEGIN { { package Eq; - use strict; - use warnings; use Moose::Role; requires 'equal_to'; @@ -26,8 +24,6 @@ BEGIN { } package Comparable; - use strict; - use warnings; use Moose::Role; with 'Eq'; @@ -60,8 +56,6 @@ BEGIN { } package Printable; - use strict; - use warnings; use Moose::Role; requires 'to_string'; @@ -71,8 +65,6 @@ BEGIN { { package US::Currency; - use strict; - use warnings; use Moose; with 'Comparable', 'Printable'; diff --git a/t/011_require_superclasses.t b/t/011_require_superclasses.t index 3925cf4..e2e6b37 100644 --- a/t/011_require_superclasses.t +++ b/t/011_require_superclasses.t @@ -13,8 +13,6 @@ BEGIN { { package Bar; - use strict; - use warnings; use Moose; eval { extends 'Foo'; }; @@ -23,8 +21,6 @@ BEGIN { { package Baz; - use strict; - use warnings; use Moose; eval { extends 'Bar'; }; @@ -33,8 +29,6 @@ BEGIN { { package Foo::Bar; - use strict; - use warnings; use Moose; eval { extends 'Foo', 'Bar'; }; @@ -43,8 +37,6 @@ BEGIN { { package Bling; - use strict; - use warnings; use Moose; eval { extends 'No::Class'; }; diff --git a/t/012_super_and_override.t b/t/012_super_and_override.t index 47b17cd..04db5de 100644 --- a/t/012_super_and_override.t +++ b/t/012_super_and_override.t @@ -12,8 +12,6 @@ BEGIN { { package Foo; - use strict; - use warnings; use Moose; sub foo { 'Foo::foo' } @@ -21,8 +19,6 @@ BEGIN { sub baz { 'Foo::baz' } package Bar; - use strict; - use warnings; use Moose; extends 'Foo'; @@ -30,8 +26,6 @@ BEGIN { override bar => sub { 'Bar::bar -> ' . super() }; package Baz; - use strict; - use warnings; use Moose; extends 'Bar'; @@ -68,15 +62,11 @@ is($foo->baz(), 'Foo::baz', '... got the right value from &baz'); { package Bling; - use strict; - use warnings; use Moose; sub bling { 'Bling::bling' } package Bling::Bling; - use strict; - use warnings; use Moose; extends 'Bling'; diff --git a/t/013_inner_and_augment.t b/t/013_inner_and_augment.t index c6f3416..76559df 100644 --- a/t/013_inner_and_augment.t +++ b/t/013_inner_and_augment.t @@ -12,8 +12,6 @@ BEGIN { { package Foo; - use strict; - use warnings; use Moose; sub foo { 'Foo::foo(' . (inner() || '') . ')' } @@ -21,8 +19,6 @@ BEGIN { sub baz { 'Foo::baz(' . (inner() || '') . ')' } package Bar; - use strict; - use warnings; use Moose; extends 'Foo'; @@ -31,8 +27,6 @@ BEGIN { augment bar => sub { 'Bar::bar' }; package Baz; - use strict; - use warnings; use Moose; extends 'Bar'; @@ -73,15 +67,11 @@ is($foo->baz(), 'Foo::baz()', '... got the right value from &baz'); { package Bling; - use strict; - use warnings; use Moose; sub bling { 'Bling::bling' } package Bling::Bling; - use strict; - use warnings; use Moose; extends 'Bling'; diff --git a/t/014_override_augment_inner_super.t b/t/014_override_augment_inner_super.t index 2d04dd1..6732c60 100644 --- a/t/014_override_augment_inner_super.t +++ b/t/014_override_augment_inner_super.t @@ -11,16 +11,12 @@ BEGIN { { package Foo; - use strict; - use warnings; use Moose; sub foo { 'Foo::foo(' . (inner() || '') . ')' }; sub bar { 'Foo::bar(' . (inner() || '') . ')' } package Bar; - use strict; - use warnings; use Moose; extends 'Foo'; @@ -29,8 +25,6 @@ BEGIN { override 'bar' => sub { 'Bar::bar -> ' . super() }; package Baz; - use strict; - use warnings; use Moose; extends 'Bar'; diff --git a/t/015_override_and_foreign_classes.t b/t/015_override_and_foreign_classes.t index 3620c56..812002e 100644 --- a/t/015_override_and_foreign_classes.t +++ b/t/015_override_and_foreign_classes.t @@ -35,8 +35,6 @@ should be just fine. sub baz { 'Foo::baz' } package Bar; - use strict; - use warnings; use Moose; extends 'Foo'; @@ -44,8 +42,6 @@ should be just fine. override bar => sub { 'Bar::bar -> ' . super() }; package Baz; - use strict; - use warnings; use Moose; extends 'Bar'; diff --git a/t/016_always_strict_warnings.t b/t/016_always_strict_warnings.t new file mode 100644 index 0000000..b81588c --- /dev/null +++ b/t/016_always_strict_warnings.t @@ -0,0 +1,47 @@ +#!/usr/bin/perl + +use Test::More tests => 10; + +# for classes ... +{ + package Foo; + use Moose; + + eval '$foo = 5;'; + ::ok($@, '... got an error because strict is on'); + ::like($@, qr/Global symbol \"\$foo\" requires explicit package name at/, '... got the right error'); + + { + my $warn; + local $SIG{__WARN__} = sub { $warn = $_[0] }; + + ::ok(!$warn, '... no warning yet'); + + eval 'my $bar = 1 + "hello"'; + + ::ok($warn, '... got a warning'); + ::like($warn, qr/Argument \"hello\" isn\'t numeric in addition \(\+\)/, '.. and it is the right warning'); + } +} + +# and for roles ... +{ + package Bar; + use Moose::Role; + + eval '$foo = 5;'; + ::ok($@, '... got an error because strict is on'); + ::like($@, qr/Global symbol \"\$foo\" requires explicit package name at/, '... got the right error'); + + { + my $warn; + local $SIG{__WARN__} = sub { $warn = $_[0] }; + + ::ok(!$warn, '... no warning yet'); + + eval 'my $bar = 1 + "hello"'; + + ::ok($warn, '... got a warning'); + ::like($warn, qr/Argument \"hello\" isn\'t numeric in addition \(\+\)/, '.. and it is the right warning'); + } +} \ No newline at end of file diff --git a/t/020_foreign_inheritence.t b/t/020_foreign_inheritence.t index b9b8372..46454ed 100644 --- a/t/020_foreign_inheritence.t +++ b/t/020_foreign_inheritence.t @@ -22,9 +22,7 @@ BEGIN { sub no_moose { $_[0]->{no_moose} } - package Foo::Moose; - use strict; - use warnings; + package Foo::Moose; use Moose; extends 'Elk'; diff --git a/t/022_moose_respects_base.t b/t/022_moose_respects_base.t index 9366b9e..c967c22 100644 --- a/t/022_moose_respects_base.t +++ b/t/022_moose_respects_base.t @@ -28,19 +28,13 @@ this test also demonstrates. sub foo { 'Foo::foo' } - package Bar; - use strict; - use warnings; - + package Bar; use base 'Foo'; - use Moose; sub new { (shift)->meta->new_object(@_) } package Baz; - use strict; - use warnings; use Moose; use base 'Foo'; } diff --git a/t/023_moose_respects_type_constraints.t b/t/023_moose_respects_type_constraints.t index 24ecd1c..ead0d1a 100644 --- a/t/023_moose_respects_type_constraints.t +++ b/t/023_moose_respects_type_constraints.t @@ -32,8 +32,6 @@ BEGIN { { # now seee if Moose will override it package Foo; - use strict; - use warnings; use Moose; } @@ -47,8 +45,6 @@ ok(!$foo_constraint->check('Bar'), '... my constraint failed correctly'); { package Bar; - use strict; - use warnings; use Moose; has 'foo' => (is => 'rw', isa => 'Foo'); diff --git a/t/030_attribute_reader_generation.t b/t/030_attribute_reader_generation.t index fd47d35..7ad1447 100644 --- a/t/030_attribute_reader_generation.t +++ b/t/030_attribute_reader_generation.t @@ -12,8 +12,6 @@ BEGIN { { package Foo; - use strict; - use warnings; use Moose; eval { diff --git a/t/031_attribute_writer_generation.t b/t/031_attribute_writer_generation.t index a76bf49..8b5e0e2 100644 --- a/t/031_attribute_writer_generation.t +++ b/t/031_attribute_writer_generation.t @@ -14,8 +14,6 @@ BEGIN { { package Foo; - use strict; - use warnings; use Moose; eval { diff --git a/t/032_attribute_accessor_generation.t b/t/032_attribute_accessor_generation.t index 5bbc1fa..f86e264 100644 --- a/t/032_attribute_accessor_generation.t +++ b/t/032_attribute_accessor_generation.t @@ -14,8 +14,6 @@ BEGIN { { package Foo; - use strict; - use warnings; use Moose; eval { diff --git a/t/033_attribute_triggers.t b/t/033_attribute_triggers.t index 361bf4f..b595177 100644 --- a/t/033_attribute_triggers.t +++ b/t/033_attribute_triggers.t @@ -14,8 +14,6 @@ BEGIN { { package Foo; - use strict; - use warnings; use Moose; has 'bar' => (is => 'rw', @@ -35,15 +33,11 @@ BEGIN { package Bar; - use strict; - use warnings; use Moose; has 'foo' => (is => 'rw', isa => 'Foo', weak_ref => 1); package Baz; - use strict; - use warnings; use Moose; has 'foo' => (is => 'rw', isa => 'Foo', weak_ref => 1); @@ -112,8 +106,6 @@ BEGIN { { package Bling; - use strict; - use warnings; use Moose; ::dies_ok { @@ -123,8 +115,6 @@ BEGIN { { package Bling::Bling; - use strict; - use warnings; use Moose; ::dies_ok { diff --git a/t/034_attribute_does.t b/t/034_attribute_does.t index f95360f..06dd05f 100644 --- a/t/034_attribute_does.t +++ b/t/034_attribute_does.t @@ -12,8 +12,6 @@ BEGIN { { package Foo::Role; - use strict; - use warnings; use Moose::Role; # if does() exists on its own, then @@ -22,8 +20,6 @@ BEGIN { has 'bar' => (is => 'rw', does => 'Bar::Role'); package Bar::Role; - use strict; - use warnings; use Moose::Role; # if isa and does appear together, then see if Class->does(Role) @@ -32,15 +28,11 @@ BEGIN { has 'foo' => (is => 'rw', isa => 'Foo::Class', does => 'Foo::Role'); package Foo::Class; - use strict; - use warnings; use Moose; with 'Foo::Role'; package Bar::Class; - use strict; - use warnings; use Moose; with 'Bar::Role'; @@ -69,8 +61,6 @@ lives_ok { { package Baz::Class; - use strict; - use warnings; use Moose; # if isa and does appear together, then see if Class->does(Role) @@ -88,8 +78,6 @@ lives_ok { sub bling { 'Bling::bling' } package Bling::Bling; - use strict; - use warnings; use Moose; # if isa and does appear together, then see if Class->does(Role) diff --git a/t/035_attribute_required.t b/t/035_attribute_required.t index 622ae0c..7248dce 100644 --- a/t/035_attribute_required.t +++ b/t/035_attribute_required.t @@ -12,8 +12,6 @@ BEGIN { { package Foo; - use strict; - use warnings; use Moose; has 'bar' => (is => 'ro', required => 1); diff --git a/t/036_attribute_custom_metaclass.t b/t/036_attribute_custom_metaclass.t index 395741b..46cd8f0 100644 --- a/t/036_attribute_custom_metaclass.t +++ b/t/036_attribute_custom_metaclass.t @@ -12,8 +12,6 @@ BEGIN { { package Foo::Meta::Attribute; - use strict; - use warnings; use Moose; extends 'Moose::Meta::Attribute'; @@ -26,8 +24,6 @@ BEGIN { }; package Foo; - use strict; - use warnings; use Moose; has 'foo' => (metaclass => 'Foo::Meta::Attribute'); @@ -53,15 +49,11 @@ is($foo_attr_type_constraint->parent->name, 'Object', '... got the right type co { package Bar::Meta::Attribute; - use strict; - use warnings; use Moose; extends 'Class::MOP::Attribute'; package Bar; - use strict; - use warnings; use Moose; ::lives_ok { diff --git a/t/037_attribute_type_unions.t b/t/037_attribute_type_unions.t index 065eb35..05b94eb 100644 --- a/t/037_attribute_type_unions.t +++ b/t/037_attribute_type_unions.t @@ -12,8 +12,6 @@ BEGIN { { package Foo; - use strict; - use warnings; use Moose; has 'bar' => (is => 'rw', isa => 'ArrayRef | HashRef'); @@ -58,8 +56,6 @@ dies_ok { { package Bar; - use strict; - use warnings; use Moose; has 'baz' => (is => 'rw', isa => 'Str | CodeRef'); diff --git a/t/038_attribute_inherited_slot_specs.t b/t/038_attribute_inherited_slot_specs.t index f1503ba..88eb18b 100644 --- a/t/038_attribute_inherited_slot_specs.t +++ b/t/038_attribute_inherited_slot_specs.t @@ -12,8 +12,6 @@ BEGIN { { package Foo; - use strict; - use warnings; use Moose; use Moose::Util::TypeConstraints; @@ -36,8 +34,6 @@ BEGIN { has 'other_fail'; package Bar; - use strict; - use warnings; use Moose; extends 'Foo'; diff --git a/t/039_attribute_delegation.t b/t/039_attribute_delegation.t index cd95613..0857453 100644 --- a/t/039_attribute_delegation.t +++ b/t/039_attribute_delegation.t @@ -16,15 +16,11 @@ BEGIN { { package Foo; - use strict; - use warnings; use Moose; has 'bar' => (is => 'rw', default => 10); package Bar; - use strict; - use warnings; use Moose; has 'foo' => ( @@ -65,16 +61,12 @@ is($bar->foo_bar, 25, '... and bar->foo_bar delegated correctly again'); { package Engine; - use strict; - use warnings; use Moose; sub go { 'Engine::go' } sub stop { 'Engine::stop' } package Car; - use strict; - use warnings; use Moose; has 'engine' => ( @@ -104,8 +96,6 @@ is($car->stop, 'Engine::stop', '... got the right value from ->stop'); { package Baz; - use strict; - use warnings; use Moose; sub foo { 'Baz::foo' } @@ -113,8 +103,6 @@ is($car->stop, 'Engine::stop', '... got the right value from ->stop'); sub boo { 'Baz::boo' } package Baz::Proxy1; - use strict; - use warnings; use Moose; has 'baz' => ( @@ -125,8 +113,6 @@ is($car->stop, 'Engine::stop', '... got the right value from ->stop'); ); package Baz::Proxy2; - use strict; - use warnings; use Moose; has 'baz' => ( @@ -137,8 +123,6 @@ is($car->stop, 'Engine::stop', '... got the right value from ->stop'); ); package Baz::Proxy3; - use strict; - use warnings; use Moose; has 'baz' => ( diff --git a/t/041_role.t b/t/041_role.t index da598a2..012720d 100644 --- a/t/041_role.t +++ b/t/041_role.t @@ -22,9 +22,6 @@ words, should 'has_method' return true for them? { package FooRole; - - use strict; - use warnings; use Moose::Role; our $VERSION = '0.01'; diff --git a/t/042_apply_role.t b/t/042_apply_role.t index 469b1dd..fae8593 100644 --- a/t/042_apply_role.t +++ b/t/042_apply_role.t @@ -12,8 +12,6 @@ BEGIN { { package FooRole; - use strict; - use warnings; use Moose::Role; has 'bar' => (is => 'rw', isa => 'FooClass'); @@ -30,16 +28,12 @@ BEGIN { }; package BarClass; - use strict; - use warnings; use Moose; sub boo { 'BarClass::boo' } sub foo { 'BarClass::foo' } # << the role overrides this ... package FooClass; - use strict; - use warnings; use Moose; extends 'BarClass'; diff --git a/t/043_role_composition_errors.t b/t/043_role_composition_errors.t index 5e182f0..a96244c 100644 --- a/t/043_role_composition_errors.t +++ b/t/043_role_composition_errors.t @@ -12,8 +12,6 @@ BEGIN { { package Foo::Role; - use strict; - use warnings; use Moose::Role; requires 'foo'; @@ -27,8 +25,6 @@ is_deeply( # classes which does not implement required method { package Foo::Class; - use strict; - use warnings; use Moose; ::dies_ok { with('Foo::Role') } '... no foo method implemented by Foo::Class'; @@ -37,8 +33,6 @@ is_deeply( # class which does implement required method { package Bar::Class; - use strict; - use warnings; use Moose; ::dies_ok { with('Foo::Class') } '... cannot consume a class, it must be a role'; @@ -50,8 +44,6 @@ is_deeply( # role which does implement required method { package Bar::Role; - use strict; - use warnings; use Moose::Role; ::lives_ok { with('Foo::Role') } '... has a foo method implemented by Bar::Role'; @@ -67,8 +59,6 @@ is_deeply( # role which does not implement required method { package Baz::Role; - use strict; - use warnings; use Moose::Role; ::lives_ok { with('Foo::Role') } '... no foo method implemented by Baz::Role'; @@ -82,8 +72,6 @@ is_deeply( # classes which does not implement required method { package Baz::Class; - use strict; - use warnings; use Moose; ::dies_ok { with('Baz::Role') } '... no foo method implemented by Baz::Class2'; @@ -92,8 +80,6 @@ is_deeply( # class which does implement required method { package Baz::Class2; - use strict; - use warnings; use Moose; ::lives_ok { with('Baz::Role') } '... has a foo method implemented by Baz::Class2'; diff --git a/t/044_role_conflict_detection.t b/t/044_role_conflict_detection.t index d209244..1295722 100644 --- a/t/044_role_conflict_detection.t +++ b/t/044_role_conflict_detection.t @@ -19,8 +19,6 @@ Mutually recursive roles. { package Role::Foo; - use strict; - use warnings; use Moose::Role; requires 'foo'; @@ -28,8 +26,6 @@ Mutually recursive roles. sub bar { 'Role::Foo::bar' } package Role::Bar; - use strict; - use warnings; use Moose::Role; requires 'bar'; @@ -39,8 +35,6 @@ Mutually recursive roles. { package My::Test1; - use strict; - use warnings; use Moose; ::lives_ok { @@ -48,8 +42,6 @@ Mutually recursive roles. } '... our mutually recursive roles combine okay'; package My::Test2; - use strict; - use warnings; use Moose; ::lives_ok { @@ -97,15 +89,11 @@ Role method conflicts { package Role::Bling; - use strict; - use warnings; use Moose::Role; sub bling { 'Role::Bling::bling' } package Role::Bling::Bling; - use strict; - use warnings; use Moose::Role; sub bling { 'Role::Bling::Bling::bling' } @@ -113,8 +101,6 @@ Role method conflicts { package My::Test3; - use strict; - use warnings; use Moose; ::throws_ok { @@ -122,8 +108,6 @@ Role method conflicts } qr/requires the method \'bling\' to be implemented/, '... role methods conflicted and method was required'; package My::Test4; - use strict; - use warnings; use Moose; ::lives_ok { @@ -132,8 +116,6 @@ Role method conflicts } '... role methods didnt conflict when manually combined'; package My::Test5; - use strict; - use warnings; use Moose; ::lives_ok { @@ -142,8 +124,6 @@ Role method conflicts } '... role methods didnt conflict when manually combined (in opposite order)'; package My::Test6; - use strict; - use warnings; use Moose; ::lives_ok { @@ -175,8 +155,6 @@ is(My::Test6->bling, 'My::Test6::bling', '... and we got the local method'); { package Role::Bling::Bling::Bling; - use strict; - use warnings; use Moose::Role; with 'Role::Bling::Bling'; @@ -199,15 +177,11 @@ Role attribute conflicts { package Role::Boo; - use strict; - use warnings; use Moose::Role; has 'ghost' => (is => 'ro', default => 'Role::Boo::ghost'); package Role::Boo::Hoo; - use strict; - use warnings; use Moose::Role; has 'ghost' => (is => 'ro', default => 'Role::Boo::Hoo::ghost'); @@ -215,8 +189,6 @@ Role attribute conflicts { package My::Test7; - use strict; - use warnings; use Moose; ::throws_ok { @@ -225,8 +197,6 @@ Role attribute conflicts '... role attrs conflicted and method was required'; package My::Test8; - use strict; - use warnings; use Moose; ::lives_ok { @@ -235,8 +205,6 @@ Role attribute conflicts } '... role attrs didnt conflict when manually combined'; package My::Test9; - use strict; - use warnings; use Moose; ::lives_ok { @@ -245,8 +213,6 @@ Role attribute conflicts } '... role attrs didnt conflict when manually combined'; package My::Test10; - use strict; - use warnings; use Moose; has 'ghost' => (is => 'ro', default => 'My::Test10::ghost'); @@ -288,8 +254,6 @@ Role override method conflicts { package Role::Plot; - use strict; - use warnings; use Moose::Role; override 'twist' => sub { @@ -297,8 +261,6 @@ Role override method conflicts }; package Role::Truth; - use strict; - use warnings; use Moose::Role; override 'twist' => sub { @@ -308,15 +270,11 @@ Role override method conflicts { package My::Test::Base; - use strict; - use warnings; use Moose; sub twist { 'My::Test::Base::twist' } package My::Test11; - use strict; - use warnings; use Moose; extends 'My::Test::Base'; @@ -326,8 +284,6 @@ Role override method conflicts } '... composed the role with override okay'; package My::Test12; - use strict; - use warnings; use Moose; extends 'My::Test::Base'; @@ -337,8 +293,6 @@ Role override method conflicts } '... composed the role with override okay'; package My::Test13; - use strict; - use warnings; use Moose; ::dies_ok { @@ -346,8 +300,6 @@ Role override method conflicts } '... cannot compose it because we have no superclass'; package My::Test14; - use strict; - use warnings; use Moose; extends 'My::Test::Base'; @@ -378,8 +330,6 @@ is(My::Test14->twist(), 'My::Test::Base::twist', '... got the right method retur { package Role::Reality; - use strict; - use warnings; use Moose::Role; ::throws_ok { diff --git a/t/045_role_exclusion.t b/t/045_role_exclusion.t index 6aa72bb..eee5539 100644 --- a/t/045_role_exclusion.t +++ b/t/045_role_exclusion.t @@ -27,21 +27,15 @@ trait InorganicMolecule extends Molecule end { package Molecule; - use strict; - use warnings; use Moose::Role; package Molecule::Organic; - use strict; - use warnings; use Moose::Role; with 'Molecule'; excludes 'Molecule::Inorganic'; package Molecule::Inorganic; - use strict; - use warnings; use Moose::Role; with 'Molecule'; @@ -62,8 +56,6 @@ the roles into the same class { package My::Test1; - use strict; - use warnings; use Moose; ::lives_ok { @@ -71,8 +63,6 @@ the roles into the same class } '... adding the role (w/ excluded roles) okay'; package My::Test2; - use strict; - use warnings; use Moose; ::throws_ok { @@ -81,8 +71,6 @@ the roles into the same class '... adding the role w/ excluded role conflict dies okay'; package My::Test3; - use strict; - use warnings; use Moose; ::lives_ok { @@ -116,15 +104,11 @@ the roles into the a superclass { package Methane; - use strict; - use warnings; use Moose; with 'Molecule::Organic'; package My::Test4; - use strict; - use warnings; use Moose; extends 'Methane'; diff --git a/t/046_roles_and_required_method_edge_cases.t b/t/046_roles_and_required_method_edge_cases.t index 77ef07a..5b4b478 100644 --- a/t/046_roles_and_required_method_edge_cases.t +++ b/t/046_roles_and_required_method_edge_cases.t @@ -55,15 +55,11 @@ second class citizens. { package Class::ProvideFoo::Base; - use strict; - use warnings; use Moose; sub foo { 'Class::ProvideFoo::Base::foo' } package Class::ProvideFoo::Override1; - use strict; - use warnings; use Moose; extends 'Class::ProvideFoo::Base'; @@ -75,8 +71,6 @@ second class citizens. override 'foo' => sub { 'Class::ProvideFoo::foo' }; package Class::ProvideFoo::Override2; - use strict; - use warnings; use Moose; extends 'Class::ProvideFoo::Base'; @@ -98,8 +92,6 @@ method modifier. { package Class::ProvideFoo::Before1; - use strict; - use warnings; use Moose; extends 'Class::ProvideFoo::Base'; @@ -111,8 +103,6 @@ method modifier. before 'foo' => sub { 'Class::ProvideFoo::foo:before' }; package Class::ProvideFoo::Before2; - use strict; - use warnings; use Moose; extends 'Class::ProvideFoo::Base'; @@ -124,8 +114,6 @@ method modifier. } '... the required "foo" method exists, but it is a before (and we will die)'; package Class::ProvideFoo::Before3; - use strict; - use warnings; use Moose; extends 'Class::ProvideFoo::Base'; @@ -138,8 +126,6 @@ method modifier. before 'foo' => sub { 'Class::ProvideFoo::foo:before' }; package Class::ProvideFoo::Before4; - use strict; - use warnings; use Moose; extends 'Class::ProvideFoo::Base'; @@ -156,8 +142,6 @@ method modifier. } '... the required "foo" method exists in the symbol table (and we will live)'; package Class::ProvideFoo::Before5; - use strict; - use warnings; use Moose; extends 'Class::ProvideFoo::Base'; @@ -183,8 +167,6 @@ method modifier. { package Class::ProvideFoo::Attr1; - use strict; - use warnings; use Moose; extends 'Class::ProvideFoo::Base'; @@ -196,8 +178,6 @@ method modifier. has 'foo' => (is => 'ro'); package Class::ProvideFoo::Attr2; - use strict; - use warnings; use Moose; extends 'Class::ProvideFoo::Base'; diff --git a/t/047_role_conflict_edge_cases.t b/t/047_role_conflict_edge_cases.t index f4a2b6f..9d31847 100644 --- a/t/047_role_conflict_edge_cases.t +++ b/t/047_role_conflict_edge_cases.t @@ -21,29 +21,21 @@ a conflict) { package Role::Base; - use strict; - use warnings; use Moose::Role; sub foo { 'Role::Base::foo' } package Role::Derived1; - use strict; - use warnings; use Moose::Role; with 'Role::Base'; package Role::Derived2; - use strict; - use warnings; use Moose::Role; with 'Role::Base'; package My::Test::Class1; - use strict; - use warnings; use Moose; ::lives_ok { @@ -68,36 +60,26 @@ a method conflict with method modifiers { package Role::Base2; - use strict; - use warnings; use Moose::Role; override 'foo' => sub { super() . ' -> Role::Base::foo' }; package Role::Derived3; - use strict; - use warnings; use Moose::Role; with 'Role::Base2'; package Role::Derived4; - use strict; - use warnings; use Moose::Role; with 'Role::Base2'; package My::Test::Class2::Base; - use strict; - use warnings; use Moose; sub foo { 'My::Test::Class2::Base' } package My::Test::Class2; - use strict; - use warnings; use Moose; extends 'My::Test::Class2::Base'; @@ -131,36 +113,26 @@ same for before/afters as well { package Role::Base3; - use strict; - use warnings; use Moose::Role; around 'foo' => sub { 'Role::Base::foo(' . (shift)->() . ')' }; package Role::Derived5; - use strict; - use warnings; use Moose::Role; with 'Role::Base3'; package Role::Derived6; - use strict; - use warnings; use Moose::Role; with 'Role::Base3'; package My::Test::Class3::Base; - use strict; - use warnings; use Moose; sub foo { 'My::Test::Class3::Base' } package My::Test::Class3; - use strict; - use warnings; use Moose; extends 'My::Test::Class3::Base'; @@ -191,29 +163,21 @@ a conflict) { package Role::Base4; - use strict; - use warnings; use Moose::Role; has 'foo' => (is => 'ro', default => 'Role::Base::foo'); package Role::Derived7; - use strict; - use warnings; use Moose::Role; with 'Role::Base4'; package Role::Derived8; - use strict; - use warnings; use Moose::Role; with 'Role::Base4'; package My::Test::Class4; - use strict; - use warnings; use Moose; ::lives_ok { diff --git a/t/054_util_type_coercion.t b/t/054_util_type_coercion.t index e1f7f42..c483323 100644 --- a/t/054_util_type_coercion.t +++ b/t/054_util_type_coercion.t @@ -12,8 +12,6 @@ BEGIN { { package HTTPHeader; - use strict; - use warnings; use Moose; has 'array' => (is => 'ro'); diff --git a/t/056_util_more_type_coercion.t b/t/056_util_more_type_coercion.t index f7afba5..e61538f 100644 --- a/t/056_util_more_type_coercion.t +++ b/t/056_util_more_type_coercion.t @@ -12,8 +12,6 @@ BEGIN { { package HTTPHeader; - use strict; - use warnings; use Moose; use Moose::Util::TypeConstraints; diff --git a/t/060_moose_for_meta.t b/t/060_moose_for_meta.t index 65326c8..dc966cd 100644 --- a/t/060_moose_for_meta.t +++ b/t/060_moose_for_meta.t @@ -19,8 +19,6 @@ Moose meta-level classes using Moose itself. { package My::Meta::Class; - use strict; - use warnings; use Moose; extends 'Moose::Meta::Class'; @@ -46,8 +44,6 @@ is_deeply( { package My::Meta::Attribute::DefaultReadOnly; - use strict; - use warnings; use Moose; extends 'Moose::Meta::Attribute'; diff --git a/t/103_subclass_use_base_bug.t b/t/103_subclass_use_base_bug.t index 8d45bc7..6052f83 100644 --- a/t/103_subclass_use_base_bug.t +++ b/t/103_subclass_use_base_bug.t @@ -18,8 +18,6 @@ a metaclass initialized for it correctly. { package Foo; - use strict; - use warnings; use Moose; package Bar; diff --git a/t/201_example.t b/t/201_example.t index ebd2bf3..33f9058 100644 --- a/t/201_example.t +++ b/t/201_example.t @@ -14,8 +14,6 @@ BEGIN { { package Constraint; - use strict; - use warnings; use Moose::Role; has 'value' => (isa => 'Num', is => 'ro'); @@ -35,8 +33,6 @@ BEGIN { sub error_message { confess "Abstract method!" } package Constraint::OnLength; - use strict; - use warnings; use Moose::Role; has 'units' => (isa => 'Str', is => 'ro'); @@ -56,8 +52,6 @@ BEGIN { { package Constraint::AtLeast; - use strict; - use warnings; use Moose; with 'Constraint'; @@ -70,8 +64,6 @@ BEGIN { sub error_message { 'must be at least ' . (shift)->value; } package Constraint::NoMoreThan; - use strict; - use warnings; use Moose; with 'Constraint'; @@ -84,16 +76,12 @@ BEGIN { sub error_message { 'must be no more than ' . (shift)->value; } package Constraint::LengthNoMoreThan; - use strict; - use warnings; use Moose; extends 'Constraint::NoMoreThan'; with 'Constraint::OnLength'; package Constraint::LengthAtLeast; - use strict; - use warnings; use Moose; extends 'Constraint::AtLeast'; diff --git a/t/202_example_Moose_POOP.t b/t/202_example_Moose_POOP.t index b68c680..d8b4c0b 100644 --- a/t/202_example_Moose_POOP.t +++ b/t/202_example_Moose_POOP.t @@ -30,8 +30,6 @@ of concept of the flexibility of the ::Instance protocol. BEGIN { package Moose::POOP::Meta::Instance; - use strict; - use warnings; use Moose; use DBM::Deep; @@ -125,8 +123,6 @@ BEGIN { } package Moose::POOP::Meta::Class; - use strict; - use warnings; use Moose; extends 'Moose::Meta::Class'; @@ -141,8 +137,6 @@ BEGIN { } { package Moose::POOP::Object; - use strict; - use warnings; use metaclass 'Moose::POOP::Meta::Class' => ( ':instance_metaclass' => 'Moose::POOP::Meta::Instance' ); @@ -158,8 +152,6 @@ BEGIN { } { package Newswriter::Author; - use strict; - use warnings; use Moose; extends 'Moose::POOP::Object'; @@ -168,8 +160,6 @@ BEGIN { has 'last_name' => (is => 'rw', isa => 'Str'); package Newswriter::Article; - use strict; - use warnings; use Moose; use Moose::Util::TypeConstraints; diff --git a/t/203_example.t b/t/203_example.t index dac32f9..3c3e463 100644 --- a/t/203_example.t +++ b/t/203_example.t @@ -23,8 +23,6 @@ sub Y { { package List; - use strict; - use warnings; use Moose::Role; has '_list' => ( @@ -49,8 +47,6 @@ sub Y { } package List::Immutable; - use strict; - use warnings; use Moose::Role; requires 'head'; @@ -88,8 +84,6 @@ sub Y { } package My::List1; - use strict; - use warnings; use Moose; ::lives_ok { @@ -97,8 +91,6 @@ sub Y { } '... successfully composed roles together'; package My::List2; - use strict; - use warnings; use Moose; ::lives_ok { diff --git a/t/lib/Bar.pm b/t/lib/Bar.pm index 8683ba5..fa1cfbd 100644 --- a/t/lib/Bar.pm +++ b/t/lib/Bar.pm @@ -1,7 +1,5 @@ package Bar; -use strict; -use warnings; use Moose; use Moose::Util::TypeConstraints; diff --git a/t/lib/Foo.pm b/t/lib/Foo.pm index e09ab0e..9d5b13b 100644 --- a/t/lib/Foo.pm +++ b/t/lib/Foo.pm @@ -1,7 +1,5 @@ package Foo; -use strict; -use warnings; use Moose; has 'bar' => (is => 'rw'); diff --git a/t/lib/MyMooseA.pm b/t/lib/MyMooseA.pm index 1dbdd3a..9e520b9 100644 --- a/t/lib/MyMooseA.pm +++ b/t/lib/MyMooseA.pm @@ -1,7 +1,5 @@ package MyMooseA; -use strict; -use warnings; use Moose; has 'b' => (is => 'rw', isa => 'MyMooseB'); diff --git a/t/lib/MyMooseB.pm b/t/lib/MyMooseB.pm index b3d4c59..c772947 100644 --- a/t/lib/MyMooseB.pm +++ b/t/lib/MyMooseB.pm @@ -1,7 +1,5 @@ package MyMooseB; -use strict; -use warnings; use Moose; 1; \ No newline at end of file