sub _check_and_extract_name {
my ($file, $verbose, $root_rx) = @_;
# check extension or executable flag
# this involves testing the .bat extension on Win32!
unless(-f $file && -T _ && ($file =~ /\.(pod|pm|plx?)\z/i || -x _ )) {
return undef;
}
return undef unless contains_pod($file,$verbose);
# ... proceed with adding the accepted file to the lost of pods ...
####
# change the order of terms in && expression
unless(-f $file _ && ($file =~ /\.(pod|pm|plx?)\z/i || -x _ ) && -T) {
return undef;
# replace the _ variable by $file
unless(-f $file && -T _ && ($file =~ /\.(pod|pm|plx?)\z/i || -x $file )) {
return undef;
####
#!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";