1. According to the File::Spec docs, which say:
    No physical check on the filesystem, but a logical cleanup of a path.
    you would be breaking the promise that this is as good as it gets without touching the filesystem.
  2. The other OS's don't need to worry about symlinks - thus "d/.." is always the same as ".". That's why a string manipulation works. On Windows, I don't need to check the filesystem to know that "a\b\c\d\.." is always always always the same as "a\b\c". On Unix, I can't make that guarantee.

So your answer is to create a new function, obviously with different documentation. Your option 2 is going to get all the unix zealots (where "zealot" is defined as "someone who cares about accuracy) to cry "don't use it!" to anyone asking about it. That's just not going to be an option for something that is part of the core distribution: above all, it must be reliable and accurate. (That's not to say everything in the core is reliable and accurate, but, so far, File::Spec is that, so we don't want to make it worse.)

Your option 1 is the only reasonable approach in my opinion. But I'm not sure how complex this really is:

use Cwd; our *abs_path = Cwd::abs_path;
Put those two lines in File/Spec.pm, add some documentation, and I think we're done.

I like that File::Spec doesn't touch the filesystem. I like that Cwd does. I'm not sure where the advantage of mixing these together is off-hand.


In reply to Re^3: Making File::Spec cross platform by Tanktalus
in thread Making File::Spec cross platform by DrWhy

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.