in reply to Re^2: How do I install a Perl module?
in thread How do I install a Perl module?

I strongly recommend not messing with the system perl on Linux! Building your own perl can be done as non-root, allows you to use the latest Perl, and gives you the freedom to experiment and play around with things without risking breaking your system Perl.

In case it's of use, this node (in the "Example: build perl v5.38 securely from source on Ubuntu" section) includes a complete example of building the latest Perl securely from source as non-root using App::cpanminus (and its cpanm command), followed by installing and uninstalling a CPAN module.

👁️🍾👍🦟

Replies are listed 'Best First'.
Re^4: How do I install a Perl module?
by afoken (Chancellor) on Oct 29, 2023 at 14:40 UTC
    I strongly recommend not messing with the system perl on Linux!

    I agree in general. But there is nothing evil or risky in the system perl IF you use it as intended by the system (i.e. the Linux distribution, but the same also applies to MacOS and the *BSDs).

    In other words, don't uninstall Perl module packages installed by the distribution installer, install modules using the distribution tools from the distribution packages, and do not install anything directly from CPAN. This effectively limits you to the Perl modules packaged by the distribution. But there are generally a lot of Perl modules available, plus the distribution takes care of installing dependencies (e.g. libxml, database drivers, graphics libraries, and so on). This way, installing Perl modules can be very convenient.

    If you prefer to tweak perl as you like, if you want to install the most recent perl modules from CPAN, or if you simply don't like to depend on other people to package Perl modules for you, then yes, stay away from the system perl and compile your own perl.


    My background is Slackware Linux, which is one of very few distributions that do NOT depend on Perl. Installing perl is recommended, but optional. (You need perl to compile the Linux kernel, though.) So I usually use the system perl. Recently, I'Ve switched to Debian stable, after using Debian (and Ubuntu) at work for years. So far, I found Debian packages for almost all Perl modules that I needed. For the few (pure-perl) modules that don't have a Debian package, I ignored my own advice from above and installed them from CPAN.

    Alexander

    --
    Today I will gladly share my knowledge and experience, for there are no sweeter words than "I told you so". ;-)

      there is nothing evil or risky in the system perl IF you use it as intended by the system

      Yes, I can see how that could be convenient for an individual working alone or in a small team (such as the OP in this thread!) ... especially for modules with complex third-party dependencies.

      As indicated here, I have been scarred by previous experiences of having to support products (which contain Perl scripts) that run on thousands of different customer machines. In such an environment, the last thing you want is to be swamped by support calls from angry customers who made a "harmless" upgrade to their OS ... which just happened to upgrade their system Perl to a version that breaks the Perl scripts included in your product.

      👁️🍾👍🦟