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
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |