use of perlbrew, requires to set an env-var and use #!/usr/bin/env perl as the shebang of all your perl scripts.

I love perlbrew but I love the shebang more. I could not look at env at the top of every perl script let alone type it. Shebang is holy and I found an easy way to preserve it to an acceptable degree and gained a very handy perlbrew switch. Like many others I have an untouched system perl and a main perlbrew with tons of cpan modules. My shebang preservation and toggle switch between system perl and perlbrew perl is achieved by making a symlink in the root directory called "user" that points to the main perlbrew path:

cd /
sudo ln -s /path/to/perl5/perlbrew/perls/perl-VERSION user

The main perlbrew path is found by typing "which perl" while brewing the main perlbrew perl and ignoring the /bin/perl part at the end. Now there are two shebangs with a single character switch that works everywhere:

#!/usr/bin/perl  # system perl
#!/user/bin/perl # perlbrew perl

On my system:

/usr/bin/perl -le 'print $^V'
v5.18.2

/user/bin/perl -le 'print $^V'
v5.26.2

This symlink has made me very happy! ☺

STOP REINVENTING WHEELS, START BUILDING SPACE ROCKETS!CPAN 🐪

In reply to Re^3: How should I manage CPAN when using two versions of Perl in my computer? by usemodperl
in thread How should I manage CPAN when using two versions of Perl in my computer? by hda

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.