Re: File::Spec catfile etc.

[email protected] (Barrie Slaymaker)
Newsgroups perl.perl5.porters,perl.macperl.porters,perl.vmsperl
Message-ID <[email protected]>
On Thu, Sep 13, 2001 at 08:57:49PM -0400, Chris Nandor wrote:
> So did we ever come to a consensus on this issue?  I think where we left it:
> 
> 1. catfile/catdir should be relative by default

Yup.

> 2. if the first argument is something denoting a root-level item ('/',
> 'HD:', 'C:')

When on that platform.  This is so non-portable that I think we should
emit warnings, so that code written on Win32, say, that calls

    $path = "C:\foo" ;
    $fullpath = File::Spec->catfile( $path, "bar" ) ;

emits a warning about non-portable usage.  However, I'd prefer that

    $fullpath = File::Spec::Win32->catfile( $path, "bar" ) ;

not warn, though it's not a big deal to me.

> or an empty string (''), then the behavior should be some sort
> of platform-specific absolute path

This should probably warn too, since it's non-portable, especially on
volume oriented machines, where MacOS has a documented fallback for the
root, Win32 could reasonably use either "C:\" or the current selected
volume for the root  (which is what "\" is).

> 3. for real absolute paths rely on catpath

Yes.

The only thing that worries me about the warnings bit is that some apps
that formerly worked will start whinging, but I think they were relying
on undocumented and unsupported behavior and in some cases we're doing
them a favor by nudging them towards portability. Of course, in other
cases we're just annoying them, but hey.

If folks agree to the warnings, than once the MacOS and VMS code, tests, and
docs settle down, I'll patch in the warnings and do doc cleanup.

Sound reasonable?

- Barrie

P.S. Just a note to disavow ownership of File::Spec. Contrary to
published reports, I don't accept/deny patches to File::Spec nor control
it's destiny.  I just help out with it, like everyone...
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.