1#!perl -wT 2# $Id$ 3use strict; 4use warnings; 5 6BEGIN { 7 use lib 't/lib'; 8 use Test::More; 9 use File::Find; 10 use File::Basename; 11 12 plan skip_all => 'set TEST_AUTHOR to enable this test' unless $ENV{TEST_AUTHOR}; 13 14 eval 'use Test::Strict 0.05'; 15 plan skip_all => 'Test::Strict 0.05 not installed' if $@; 16 plan skip_all => 'Need untaint in newer File::Find' if $] <= 5.006; 17}; 18 19## I hope this can go away if Test::Strict or File::Find::Rule 20## finally run under -T. Until then, I'm on my own here. ;-) 21my @files; 22my %trusted = ( 23 24); 25 26find({ wanted => \&wanted, 27 untaint => 1, 28 untaint_pattern => qr|^([-+@\w./]+)$|, 29 untaint_skip => 1, 30 no_chdir => 1 31}, qw(lib t)); 32 33sub wanted { 34 my $name = $File::Find::name; 35 my $file = fileparse($name); 36 37 return if $name =~ /TestApp/; 38 39 if ($name =~ /\.(pm|pl|t)$/i && !exists($trusted{$file})) { 40 push @files, $name; 41 }; 42}; 43 44if (scalar @files) { 45 plan tests => scalar @files; 46} else { 47 plan tests => 1; 48 fail 'No perl files found for Test::Strict checks!'; 49}; 50 51foreach (@files) { 52 warnings_ok($_); 53}; 54