[32649] in Perl-Users-Digest

home help back first fref pref prev next nref lref last post

Perl-Users Digest, Issue: 3925 Volume: 11

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Apr 16 00:09:27 2013

Date: Mon, 15 Apr 2013 21:09:09 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Mon, 15 Apr 2013     Volume: 11 Number: 3925

Today's topics:
    Re: Find::File OS/2 <ben@morrow.me.uk>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

----------------------------------------------------------------------

Date: Mon, 15 Apr 2013 23:54:33 +0100
From: Ben Morrow <ben@morrow.me.uk>
Subject: Re: Find::File OS/2
Message-Id: <92du3a-4ke.ln1@anubis.morrow.me.uk>


Quoth "Dave Saville" <dave@invalid.invalid>:
> I have a script that needs to obtain a list of files. The script takes
> an argument as to where to start looking in the directory tree. So I 
> issue
> 
> find(\&wanted, $start);
> 
> If $start equals drive and directory such as t:/foo then all is fine. 
> But if I need to start in the root of a drive such as t: then find 
> throws an error:
> 
> Can't stat t:: No such file or directory
> 
> Note the double colon.
> 
> t: & t:/ both give the same error.

Well, the first thing to say is that File::Find appears to strip a
trailing slash off the path passed to it, unless that path is "/". The
relevant bit of File::Find is (I think; the code's rather hard to
follow) line 521, in sub _find_opt:

        if ($Is_Win32) {
            $top_item =~ s|[/\\]\z||
              unless $top_item =~ m{^(?:\w:)?[/\\]$};
        }
        else {
            $top_item =~ s|/\z|| unless $top_item eq '/';
        }

so my first guess would be that this is an OS/2 portability bug, and
OS/2 should be included in the first branch of the if. It might be worth
changing your copy to see if that works, and checking all the other uses
of $Is_Win32 in that file as well. If this fixes the problem, report a
bug to p5p.

> Just giving t gives a slightly different error with t: rather than t::
> 
> t:/. works as does t:. - but messes all subsequent returned fully 
> qualified paths as in t:/./foo. 

Out of interest, does OS/2 have the same behaviour as Win32, where "t:"
is not the same path as "t:/"? On Win32 the system maintains a current
directory per drive plus a current drive, and "t:" refers to the current
directory on drive t rather than its root.

Ben



------------------------------

Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 6 Apr 01)
Message-Id: <null>


Administrivia:

To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.

Back issues are available via anonymous ftp from
ftp://cil-www.oce.orst.edu/pub/perl/old-digests. 

#For other requests pertaining to the digest, send mail to
#perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
#sending perl questions to the -request address, I don't have time to
#answer them even if I did know the answer.


------------------------------
End of Perl-Users Digest V11 Issue 3925
***************************************


home help back first fref pref prev next nref lref last post