There is one answer by merlyn showing where the alternative will break

There are no cases where what FindBin does is better than the much simpler alternative algorithm. You can construct rather bizarre cases where FindBin happens to get the right answer for the wrong reasons, just like even a stopped clock is right twice each day.

FindBin is convenient... and quite perverse and gets the wrong answer in more ordinary situations than are required to break the sane algoritm. For example, if I have a "script" file in a directory in my $ENV{PATH} but I use "perl script" to test a local copy instead, FindBin will incorrectly report that I'm using the copy in my $ENV{PATH}. For most other cases, FindBin just uselessly (and perversely) searches $ENV{PATH} but usually gets to the right answer anyway.

while the other poster insisted that it should make additional things (resolve symbolic links for arbitrary files)

However you like to see it. I don't recall insisting anything. I find FindBin perverse. Going to the effort to search $ENV{PATH} for executable files but not bothering to offer that capability in any kind of general way is not a great idea in my book. FindBin does some rather strange things, and these very effectively prevent its algorithm from being reused for anything other than the overly narrow problem statement that the authors were so nice to document.

I'm glad they managed to (most of the time) serve the purpose that they documented. I didn't say otherwise. I find sad the narrowness of the purpose of the module. Serving that narrow purpose in no way precludes serving similar related purposes (that also fit the name of the module much more accurately).

Similarly, the less important feature(s) of getting the "real" path and then splitting it into dirname and basename should also be available in a general manner. I didn't look at Cwd and so didn't see that first part available in a module (well, except for FindBin except that it is only available for the overly narrow uses that the module perversely caters to), so I complained about there being yet another useful item that the authors of FindBin bothered to code a solution for and yet didn't bother to make it available in any reusable way.

It is unfortunate that one has to use at least 2 of Cwd, File::Basename, and File::Spec to get reusable versions of the closely related features of "convert relative path to absolute", "resolve symbolic links to a real path", and "split path into dirname and basename". I'd hope that these would get collected into File::Spec as a standardized location for the common file specification manglings.

- tye        


In reply to Re^9: FindBin works differently on Fedora Core 2? (comprehension) by tye
in thread FindBin works differently on Fedora Core 2? by samtregar

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.