What are you thoughts about using Cwd::abs_path() instead of $FindBin::Bin?

Motivation

In Mojolicious the auto-generated application script contains:

use FindBin; BEGIN { unshift @INC, "$FindBin::Bin/../lib" }

The issue I have with this is: $FindBin::Bin will not resolve a symbolic link. This can be fine in cases where you want to use different libraries with the same script. Simply create a symbolic link of the script to the location where your different libraries are.

But in my situation I simply wanted to create a symbolic link of the startscript to /usr/local/bin. Of course this is doomed to fail as I will end up with "/usr/local/bin/../lib". But the libraries are in "/app/myapp/lib".

So I've changed it now to

use Cwd 'abs_path'; BEGIN { unshift @INC, abs_path("$0/../../lib") }

Not only will it work in my situation, additionally the "relative part" gets resolved and the path added to @INC will be "/app/myapp/lib".

Questions

  1. Will it fail in any situation you can think of?
  2. Is there any disadvantage in using Cwd instead of FindBin?
  3. What are your thoughts on this matter?

s$$([},&%#}/&/]+}%&{})*;#$&&s&&$^X.($'^"%]=\&(|?*{%
+.+=%;.#_}\&"^"-+%*).}%:##%}={~=~:.")&e&&s""`$''`"e

In reply to Cwd::abs_path or FindBin::Bin? by Skeeve

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.