in reply to When in Rome: Re: colons don't always separate path items!
in thread colons don't always separate path items!

Actualy, that's a rather strange assumption, considering that for, say use lib you should use the unix convention, no matter where you are.

Hidden assumptions are dangerous things.


Warning: Unless otherwise stated, code is untested. Do not use without understanding. Code is posted in the hopes it is useful, but without warranty. All copyrights are relinquished into the public domain unless otherwise stated. I am not an angel. I am capable of error, and err on a fairly regular basis. If I made a mistake, please let me know (such as by replying to this node).

Replies are listed 'Best First'.
Re: Re: When in Rome: Re: colons don't always separate path items!
by diotalevi (Canon) on Jul 01, 2003 at 22:04 UTC

    I'd characterize lib's use of unix conventions as unusual. Having environment variables with values suitable for a different operating system would be odd. It might be because of the source file, operating environment distinction though. lib's value is used at compile time and is directly in the source so it may be less copacetic to require a OS-neutral representation. The environment variable though is completely divorced from the perl script. In fact, it is applicable to all perl scripts so in that context I still hold that it would strange to require unix conventions in a very non-unix place.

      Oh, lib's use of unix path conventions, and PERL5LIB (et al)'s use of the arch-specific list-of-paths seperators both make perfect sense. They're both the correct decisions for where they're being used and what they are. OTOH, I just meant to point out that nothing of that sort is obvious; they should all be documented.


      Warning: Unless otherwise stated, code is untested. Do not use without understanding. Code is posted in the hopes it is useful, but without warranty. All copyrights are relinquished into the public domain unless otherwise stated. I am not an angel. I am capable of error, and err on a fairly regular basis. If I made a mistake, please let me know (such as by replying to this node).

Re: When in Rome: Re: colons don't always separate path items!
by Abigail-II (Bishop) on Jul 01, 2003 at 23:51 UTC
    I'm confused. use lib takes a list as argument, each element of the list being a directory to search. To which UNIX convention are you referring - I don't know any commonly used environment variable that takes a list (after all, the variables are scalars).

    Abigail

      I was refering to pathname conventions -- specificly, the path seperator should always be '/', not that of the platform where the code is running. To quote the POD (5.8.0), "In order to keep lib.pm small and simple, it only works with Unix filepaths. This doesn't mean it only works on Unix, but non-Unix users must first translate their file paths to Unix conventions." (Interestingly, this seems to increase, not decrese, the size of lib.pm -- of couse, it makes the code /using/ lib much simpiler.)


      Warning: Unless otherwise stated, code is untested. Do not use without understanding. Code is posted in the hopes it is useful, but without warranty. All copyrights are relinquished into the public domain unless otherwise stated. I am not an angel. I am capable of error, and err on a fairly regular basis. If I made a mistake, please let me know (such as by replying to this node).

        The POD is wrong at worst and misleading at best:

        use lib 'd:\\foo\\bar'; use Baz; __END__ in Baz! at d:\foo\bar/Baz.pm line 3. Compilation failed in require at c:\temp\tlib.pl line 2. BEGIN failed--compilation aborted at c:\temp\tlib.pl line 2.
        #D:\foo\bar\baz.pm package Baz; die "in Baz!";

        And its pretty damn stupid. How on earth to you convert a D:\foo or a \\machine\share to a "unix convention"? And is it reasonable to expect every Perl programmer to be familiar with Unix conventions?

        Unix bigotry in perl really annoys me. The p5p mob should know better.


        ---
        demerphq

        <Elian> And I do take a kind of perverse pleasure in having an OO assembly language...
Re: Re: When in Rome: Re: colons don't always separate path items!
by belg4mit (Prior) on Jul 02, 2003 at 02:16 UTC
    That's not really a lib specific thing now is it? You can for instance, still feed UNIX style paths to open etc. Granted it's not the only way, but it is probably the sanest.

    --
    I'm not belgian but I play one on TV.