#!perl -w use strict; use Pod::Find; # # Test Pod::Find::pod_find on C:/perl/bin # my $dir = 'C:/perl/bin'; my %pods = Pod::Find::pod_find({ -verbose => 1}, $dir); my @pods = keys %pods; my $n = keys %pods; printf "Found $n files containing pods: @pods\n"; printf "NOTE 1: above finds .pl but not .bat files containing pods\n\n"; # # Test using _ variable in filestests # my $bat = 'c:/perl/bin/pod2html.bat'; my $exe = 'c:/perl/bin/perl.exe'; filetest ($bat); filetest ($exe); printf "NOTE 2: above shows that -x _ basically works as advertized\n\n"; sub filetest { my $file = shift; print "$file: "; stat($file); print " Readable" if -r _; print " Writable" if -w _; print " Executable" if -x _; print " Text" if -T _; print " Binary" if -B _; print "\n"; } # # Demo the bug and workarounds # # simplified from Pod::Find, -x _ does not work printf "1 $bat ok for pod: %d\n", (-f $bat && -T _ && -x _); # 4 workarounds printf "2 $bat ok for pod: %d\n", (-f $bat && -x _ && -T _); printf "3 $bat ok for pod: %d\n", (-f $bat && -x $bat && -T _); printf "4 $bat ok for pod: %d\n", (-f $bat && -T _ && -x $bat); printf "5 $bat ok for pod: %d\n", (-f $bat && -T $bat && -x $bat); printf "NOTE 3: above shows that -x _ does not work as advertized in case 1\n\n";