From: Graham Knop Date: Fri, 13 Jun 2014 12:05:50 +0000 (-0400) Subject: make hints test immune to perl -M options X-Git-Tag: v1.003000~7 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=c97f63974c1d1d0b422306ab24391fd256cbeceb;p=p5sagit%2FEval-WithLexicals.git make hints test immune to perl -M options --- diff --git a/t/hints.t b/t/hints.t index 6a07969..88bbec3 100644 --- a/t/hints.t +++ b/t/hints.t @@ -3,22 +3,8 @@ use Test::More; use Eval::WithLexicals; use lib 't/lib'; -my $strictures_hints; -my $strictures_warn; -{ - local $ENV{PERL_STRICTURES_EXTRA} = 0; - eval q{ - use strictures 1; - BEGIN { - # Find the hint value that 'use strictures 1' sets on this perl. - $strictures_hints = $^H; - $strictures_warn = ${^WARNING_BITS}; - }; - 1; - } or die $@; -}; - use strictures 1; +use get_strictures_hints qw($strictures_hints $strictures_warn); my $eval = Eval::WithLexicals->with_plugins("HintPersistence")->new(prelude => ''); diff --git a/t/lib/get_strictures_hints.pm b/t/lib/get_strictures_hints.pm new file mode 100644 index 0000000..f3f36fd --- /dev/null +++ b/t/lib/get_strictures_hints.pm @@ -0,0 +1,21 @@ +package get_strictures_hints; + +local $ENV{PERL_STRICTURES_EXTRA} = 0; +our $strictures_hints; +our $strictures_warn; + +eval q{ + use strictures 1; + BEGIN { + # Find the hint value that 'use strictures 1' sets on this perl. + $strictures_hints = $^H; + $strictures_warn = ${^WARNING_BITS}; + }; + 1; +} or die $@; + +require Exporter; +*import = \&Exporter::import; +our @EXPORT = qw($strictures_hints $strictures_warn); + +1;