6 use Config qw/%Config/;
8 use Test::More tests => 4;
10 sub Str::TYPEDSCALAR {
11 my $buf = (caller(0))[2];
12 open $_[1], '<', \$buf;
21 is $r, __LINE__-2, 'trick for our - readline';
25 is $s, __LINE__-2, 'trick for my - readline';
28 is $z, 7, 'trick for others';
33 sub Int::TYPEDSCALAR { push @lines, (caller(0))[2]; () }
36 skip 'Broken with threaded perls before 5.8.4' => 1
37 if $Config{useithreads} and $] < 5.008004;
39 use Lexical::Types as => sub {
40 # In 5.10, this closure is compiled before hints are enabled, so no hintseval
41 # op is added at compile time to propagate the hints inside the eval.
42 # That's why we need to re-use Lexical::Types explicitely.
43 eval 'use Lexical::Types; my Int $x';
48 is_deeply \@lines, [ 1, __LINE__-1 ], 'hooking inside the \'as\' callback';