How do I specify which version of perl is being used when I install a module using cpanm?

You should have two cpanm, one installed with each perl. They will have different shebang (#!) lines.

It's simply a question of using the right cpanm (e.g. by using its full path to launch it).

head -n 1 /tool/bin/cpanm # #!/tool/bin/perl /tool/bin/cpanm Some::Module # Installs for /tool/bin/perl

The cpanm script itself should work with any perl, so you could explicitly specify the perl to use as a fallback.

/tool/bin/perl "$( which cpanm )" Some::Module

Why do the new modules I installed to /new_location/perl_modules/5.20/lib/perl5 work for both /tool/bin/perl (v5.20.0) and /usr/bin/perl (v5.26.3)

There's no guarantee that using different build will fail.

There's merely no effort made to ensure that it won't fail.


In reply to Re: "symbol lookup error" message help by ikegami
in thread "symbol lookup error" message help by Special_K

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.