Same result on 5.12.0 (Strawberry, Win XP). Attaching better test program.
On Tue Jun 26 20:04:00 2001, Rudif@bluemail.ch wrote:
> On Win2k, AS Perl build 626 -
> but not on Linux -
>
>
> I have found that executing the filetest
> -T _ or -B _ has the side effect of
> causing the subsequent
> filetest -x _ to give the wrong answer (false where it should be
> true).
>
> The script below demonstrates the problem.
> Specifically, subs filetest2() and filetest3() below fail to
> identify files
> c:/perl/bin/pod2html.bat c:/perl/bin/perl.exe as
> Executable, while the
> reference sub filetest0() identifies them
> correctly.
> Also, there are two workarounds for the problem, in
> subs filetest1() and filetest4():
> use -x _ BEFORE -T or -B, or use
> -x $file.
>
>
>
> I have discovered this problem while I was running
> Version 0.21 Pod::Find::pod_find() to
> list pod-containing files
> in C:/perl/bin, where I expected to see several .bat files listed.
> But there were none, although several of them contain pod (e.g.
> pod2html.bat).
>
> I looked into Pod::Find, drilled down into
> _check_and_extract_name() and I found the code ...
>
>
> 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 ...
> ... that decides to accept or reject a file, based on the extension
> and on file tests.
> In the case of .bat files, this code was
> returning undef.
>
>
> After some experimenting I found two
> workarounds that fix the problem:
>
> unless(-f $file _ &&
> ($file =~ /\.(pod|pm|plx?)\z/i || -x _ ) && -T) {
> return
> undef;
>
> unless(-f $file && -T _ && ($file =~
> /\.(pod|pm|plx?)\z/i || -x $file )) {
> return undef;
>
> These
> are consistent with workarounds shown in the script below.
--
Alexandr Ciornii, http://chorny.net
Thread Previous