6 if (eval { require PPI; 1 }) {
7 plan tests => scalar(@Support::Files::testitems);
9 plan skip_all => "PPI not installed";
14 local $^W = 0; # Don't complain about non-existent filehandles
15 if (-e \*Test::More::TESTOUT) {
16 $fh = \*Test::More::TESTOUT;
17 } elsif (-e \*Test::Builder::TESTOUT) {
18 $fh = \*Test::Builder::TESTOUT;
24 my @testitems = @Support::Files::testitems;
26 foreach my $file (@testitems) {
28 my $doc = PPI::Document->new($file);
29 my $stmts = $doc->find('Statement::Variable');
31 for my $var (@{ $stmts || [] }) {
32 # local can have valid uses like this, and our is extremely uncommon
33 next unless $var->type eq 'my';
36 next unless $var->find(sub { $_[1]->content eq 'if' });
38 # token "if" is not in the top level struvture - no problem
39 # most likely an anonymous sub or a complicated map/grep/reduce
40 next unless grep { $_->content eq 'if' } $var->schildren;
43 print $fh "?: $var \n";