Valid point; my counter to that would be that if you've got PATH changing randomly and/or unintentionally for production execution environments then you've got an equally large problem.

The issue with hardcoding links is that you can't then change the referenced name without altering which perl you get for everything running against the same filesystem usting that name. You also can't trivially test the same copy of script X (especially if it's called via system down n levels deep by several other scripts so you can't easily prefix the call with /my/other/perl X ...) under a different perl without then editing the shebang for script X. And now everyone running that same copy is going to have to run under that different perl; so you really need to make a different copy and you're back to playing games with PATH to have just that tweaked version found first.

Granted with containers these days it's much easier to get an identical-but-for environment whipped up (in which case it's trivial to go with either approach; depend on PATH or depend on the shebang but you're in a one-off superchroot that can't see anything wrong because there's nothing else on the same "box" for it to see wrong). Pick the approach that works best for you and be aware of the constraints your chosen approach has (hardcoded shebangs means editing and creating a separate copy of scripts to test, whereas PATH lets you change without editing but makes you sensitive to environmental changes).

Edit: I was otherwise distracted when replying and glossed over the alias bit mentioned below; that's an interesting approach.

The cake is a lie.
The cake is a lie.
The cake is a lie.


In reply to Re^4: How to run a legacy perl version smoothly from perlbrew & Carton by Fletch
in thread How to run a legacy perl version smoothly from perlbrew & Carton by chrestomanci

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.