From: Dagfinn Ilmari Mannsåker Date: Sat, 4 May 2013 20:30:10 +0000 (+0100) Subject: Silence warning in pre-5.8.3 weaken test X-Git-Tag: v1.002000~2 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=e25e8acf5535c74e71e72fda414ebf9504a52ea1;p=gitmo%2FMoo.git Silence warning in pre-5.8.3 weaken test --- diff --git a/lib/Moo/_Utils.pm b/lib/Moo/_Utils.pm index 9669cbf..b49d8c1 100644 --- a/lib/Moo/_Utils.pm +++ b/lib/Moo/_Utils.pm @@ -5,7 +5,7 @@ no warnings 'once'; # guard against -w sub _getglob { \*{$_[0]} } sub _getstash { \%{"$_[0]::"} } -use constant lt_5_8_3 => ( $] < 5.008003 ) ? 1 : 0; +use constant lt_5_8_3 => ( $] < 5.008003 or $ENV{MOO_TEST_PRE_583} ) ? 1 : 0; use constant can_haz_subname => eval { require Sub::Name }; use strictures 1; diff --git a/t/accessor-weaken-pre-5_8_3.t b/t/accessor-weaken-pre-5_8_3.t index 8505a48..a0f9b1d 100644 --- a/t/accessor-weaken-pre-5_8_3.t +++ b/t/accessor-weaken-pre-5_8_3.t @@ -1,9 +1,7 @@ use strictures 1; -use Moo::_Utils; BEGIN { - no warnings 'redefine'; - *Moo::_Utils::lt_5_8_3 = sub () { 1 }; + $ENV{MOO_TEST_PRE_583} = 1; } (my $real_test = __FILE__) =~ s/-pre-5_8_3//; diff --git a/t/accessor-weaken.t b/t/accessor-weaken.t index 5da1435..245ea7a 100644 --- a/t/accessor-weaken.t +++ b/t/accessor-weaken.t @@ -1,5 +1,9 @@ use strictures 1; use Test::More; +use Moo::_Utils; + +ok(Moo::_Utils::lt_5_8_3, "pretending to be pre-5.8.3") + if $ENV{MOO_TEST_PRE_583}; { package Foo;