develooper Front page | perl.perl5.porters | Postings from March 2000

File::Spec oddities.

From:
Barrie Slaymaker
Date:
March 14, 2000 13:21
Subject:
File::Spec oddities.
Message ID:
38CEAD55.E618F954@lm.com
[Cc:ed to p5p]

Tim Jenness wrote:
> 
> Oddities I found:
> 
>   - no method to concatenate a volume to a directory tree.
>     Only a method to concatentate volume, directory and file together.
>     I assumed that I could just supply a '' as a filename and it would
>     work but that wasn't a documented feature :-)

I'll document that.  One thing that's a gotcha is the meaning of '' as a 
dirname on different platforms.  On a Mac ":::" is equivalent to '../../', 
for instance.  Here's a quick guide (from memory, to be corrected if I got
it backwards):

Calling                      Returns
===========================  ================
Mac->splitdirs( ':a:b' )     ( '', 'a', 'b' ), a relative path
VMS->splitdirs( '[.a.b]' )   ( '', 'a', 'b' ), a relative path
Unix->splitdirs( '/a/b' )    ( '', 'a', 'b' ), an absolute path
Unix->splitdirs( 'a/b' )     ( 'a', 'b' ),     a relative path

>   - It would be good if the tmpdir() function had the ability to only
>     return directories that were not tainted. For example, $ENV{TMPDIR}
>     is returned even though that is not safe. An extra argument to
>     tmpdir() could be used to only return, in this case '/tmp' explicitly.
>     Additionally, it would be good if P_tmpdir was available as well since
>     this is the default tempdir set by the system in stdio.h. That
>     would require XS though and I don't imagine we could sneak it into
>     Fcntl.xs or somewhere :-)



nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About