diff --git a/lib/Test/PerlTidy.pm b/lib/Test/PerlTidy.pm index 1fd7616..43e759a 100644 --- a/lib/Test/PerlTidy.pm +++ b/lib/Test/PerlTidy.pm @@ -129,6 +129,9 @@ sub list_files { my $finder = File::Finder->type('f')->name(qr{[.](?:pl|pm|PL|t)$}); $finder->{options}->{untaint} = 1; + $finder->{options}->{untaint_pattern} = + qr{^((\p{IsAlphabetic}:)?[-+@\w./~[(][)] ]+)$}x ## no critic (Variables::ProhibitPunctuationVars) + if $OSNAME eq 'MSWin32'; my @files = $finder->in($path); my %keep = map { File::Spec->canonpath($_) => 1 } @files; diff --git a/t/exclude_files.t b/t/exclude_files.t index 91c1c12..241150b 100644 --- a/t/exclude_files.t +++ b/t/exclude_files.t @@ -20,6 +20,8 @@ my @wanted_files = sort qw( t/strict.t ); +@wanted_files = map { s/\//\\/g; $_ } @wanted_files if $^O eq 'MSWin32'; + my @found_files = Test::PerlTidy::list_files( path => '.', exclude => [ 'blib', 'lib' ], diff --git a/t/list_files.t b/t/list_files.t index 3658c5f..f01aad4 100644 --- a/t/list_files.t +++ b/t/list_files.t @@ -21,6 +21,8 @@ my @wanted_files = sort qw( t/strict.t ); +@wanted_files = map { s/\//\\/g; $_ } @wanted_files if $^O eq 'MSWin32'; + my @found_files = Test::PerlTidy::list_files('.'); is_deeply( \@wanted_files, \@found_files );