2 # Find the hint value that 'use strictures 1' sets on this perl.
4 BEGIN { $strictures_hints = $^H }
7 use Eval::WithLexicals;
9 my $eval = Eval::WithLexicals->with_plugins("HintPersistence")->new(prelude => '');
12 [ $eval->eval('$x = 1') ],
14 'Basic non-strict eval ok'
22 $eval->eval('use strictures 1');
25 local $SIG{__WARN__} = sub { };
27 ok !eval { $eval->eval('$x') }, 'Unable to use undeclared variable';
28 like $@, qr/requires explicit package/, 'Correct message in $@';
32 $eval->hints->{q{$^H}}, \$strictures_hints,
33 'Hints are set per strictures'
41 # Assumption about perl internals: sort pragma will set a key in %^H.
43 $eval->eval(q{ { use sort 'stable' } }),
44 ok !exists $eval->hints->{q{%^H}}->{sort},
45 "Lexical pragma used below main scope not captured";
47 $eval->eval(q{ use sort 'stable' }),
48 ok exists $eval->hints->{q{%^H}}->{sort},
49 "Lexical pragma captured";