in reply to Very confused about system perl and local perl

If you use 'sudo apt-get install', then the modules get installed by the 'root' user into the system perl area - which is what you want to do if you have multiple users on the machine and they ALL want access to those perl modules.

If you run cpan using the system perl, you can control where cpan puts the modules. By default, it will put stuff under /usr/lib/perl5/site_perl. The modules that come with the system perl are also under /usr/lib/perl5, but not in site_perl. So you should actually be okay doing it this way. To be safe, you can configure cpan to put things into a different localtion, like "~/lib". Then you have to add a line like "use lib 'path/to/my/lib';" in all your scripts, so it can find your modules.

The advantage of using apt-get is that the package manager takes care of installing anything else that a module might depend on, and it knows if something gets updated, etc. But the package manager usually does not have the latest greatest versions of every module, and some modules are not in the package manager at all, so a little bit of mix-n-match is probably unavoidable. I personally tend to you apt-get for modules that require external c libraries. It's possible to download/compile/install things like this in your 'home' directory, but it can be a real pain. For pure-perl modules, cpan usually works great.

The most important step, I think, is that you first make good backups. Just use something like tar&split to backup your entire system to an external USB drive before installing something. That way, if something breaks, you can simply revert back to what you had.

  • Comment on Re: Very confused about system perl and local perl

Replies are listed 'Best First'.
Re^2: Very confused about system perl and local perl
by Anonymous Monk on Oct 28, 2010 at 16:04 UTC
    Ok, that looks as if I 'know' what I am doing as I understand all of that now. The problem I am having with using my local copy of perl is that all of the instructions for things I need to install assume I can just use apt-get, but I can't, so then I have to try and find the appropriate CPAN modules and their dependencies which is a bit trickier when you are a beginner. I dont even know the proper names of what I should be looking for which doesn't help and searching google doesnt help either!
      They're listed in the META.yaml file included in the distribution.
      "finding their dependencies". As ikegami remarked in the other thread about this topic today, the CPAN shell does that for you

        cpan is good at finding/installing dependent perl modules, but if you want to install something like GD, you need to install the c library libgd (and also libjpeg, libzlib, libttf, etc. to enable all possible features). The last time I had to install GD, cpan did not help get all these external libraries - but installing GD via the package manager (apt-get on ubuntu), did.

        I didn't use the right term. I meant finding the CPAN version of the apt-get modules isn't always that easy, especially as a beginner. All my instructions are for apt-get and when you aren't very confident you'd rather just following instructions than try and translate between the 2. I tried installing a CPAN module today which failed whereas the apt-get command whizzed through. Beginners don't want things failing!