in reply to Re: path to perl on umbuntu
in thread path to perl on umbuntu

Thanks for your reply. I will look at downloading and installing another version of Perl. Is there somewhere specific where I should install it? Presumbly I then have to change the line at the top of my perl scripts from #!/usr/bin/perl to this new path?

Also if I then need to use CPAN to download new perl modules etc, how will CPAN know to put these in my new perl installation path and not the system perl?

Replies are listed 'Best First'.
Re^3: path to perl on umbuntu
by marto (Cardinal) on Oct 27, 2010 at 13:54 UTC

    When configuring perl you could tell it to install in /opt/perl:

    ./Configure -des -Dprefix=/opt/perl

    Be sure to read the Readme and INSTALL files prior to installation. Your newly built perl will have it's own version of cpan (in the example above under /opt/perl/bin/cpan), it knows where to put modules.

      I will definitely read the install and readme files prior to installation but I can't find them :) The only perl download I can find for ubuntu 10.10 is this one http://packages.ubuntu.com/maverick/perland it doesn't have an install guide and this is perl 5.10

      Also this list of dependencies refers to some modules I have already installed on the linux machine using apt-get. Does that matter? Can they share these files? For example I have already installed make.

      Many thanks

        As I said, you'll need to compile your own, rather than use a packaged version. Download the latest stable source from here. Extract it to your home directory. Read the Readme and Install files and report back if you have any problems.

Re^3: path to perl on umbuntu
by morgon (Priest) on Oct 27, 2010 at 14:01 UTC
    Is there somewhere specific where I should install it?
    It does not really matter much, I usually install it as my normal user (not as root) to my home-directory (a subdir of my home that is).

    Presumbly I then have to change the line at the top of my perl scripts from #!/usr/bin/perl to this new path?
    Yes, that's right and you should also set the PATH-enviroment variable (or whatever your shell uses as search-path) up in such a way that your "new" perl is found before the "old", so that you can simply type "perl" on your command prompt and get the new one.

    how will CPAN know to put these in my new perl installation path and not the system perl?
    On installation perl remembers where it is installed and so knows where to install modules (just don't mess with the defaults during installation).

    You later then only have to run the proper perl and everything will be sorted (i.e. wether you run it via perl -MCPAN -e shell or simply via cpan you just have to make sure that your shell is picking up the newly installed perl/cpan).