A method for this that I've used in the past is to have an account other than root for building software (then only run the install step as root). If you have (or can make) such an account, simply chown -R not-root /opt/apps/perl/perl5220, run the CPAN tools as not-root, and see if it works.

Since you are not running the install as root, it will fail if an attempt is made to write to the system perl, and you can be confident that, at worst, only the app perl that you were trying to change can be messed up.

Afterwards, chown -R root /opt/apps/perl/perl5220 will put things back the way they were.

Unless, of course, /opt/app/perl/perl5220 is already owned by an account other than root, in which case you can avoid the chown dance and can simply run the CPAN tools under that account, where they will not be allowed to touch the system perl.

A final caveat: This assumes that the system perl is owned by root. If the system perl is not owned by root, then you will need to figure out who changed that and why.


In reply to Re: How to install modules for local perl without changing anything on system perl? by jcb
in thread [Solved]: How to install modules for local perl without changing anything on system perl? by Perl300

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.