4 local $ENV{PERL_STRICTURES_EXTRA} = 0;
5 strictures->VERSION(1); strictures->import();
6 # Find the hint value that 'use strictures 1' sets on this perl.
7 $strictures_hints = $^H;
12 use Eval::WithLexicals;
15 my $eval = Eval::WithLexicals->with_plugins("HintPersistence")->new(prelude => '');
18 [ $eval->eval('$x = 1') ],
20 'Basic non-strict eval ok'
28 $eval->eval('use strictures 1');
31 local $SIG{__WARN__} = sub { };
33 ok !eval { $eval->eval('$x') }, 'Unable to use undeclared variable';
34 like $@, qr/requires explicit package/, 'Correct message in $@';
38 $eval->hints->{q{$^H}}, \$strictures_hints,
39 'Hints are set per strictures'
47 # Assumption about perl internals: sort pragma will set a key in %^H.
48 $eval->eval(q{ { use hint_hash_pragma 'param' } }),
49 ok !exists $eval->hints->{q{%^H}}->{hint_hash_pragma},
50 "Lexical pragma used below main scope not captured";
52 $eval->eval(q{ use hint_hash_pragma 'param' }),
53 is $eval->hints->{q{%^H}}->{hint_hash_pragma}, 'param',
54 "Lexical pragma captured";