Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer

Installing CPAN without root access

by vihar (Acolyte)
on Sep 10, 2013 at 14:04 UTC ( #1053274=perlquestion: print w/replies, xml ) Need Help??
vihar has asked for the wisdom of the Perl Monks concerning the following question:

I am trying to install CPAN so I can install some CPAN Perl modules. I don't have root access so I am trying to install everything on this remote server locally under my user id.

I tried the yum command:  yum -y install perl-CPAN which obviously doesn't work because I am not a root user.

I also tried installing CPAN without yum command, which just returns an error saying can't be located.

I did my research and gathered info that in order to install these modules locally, I would need to set proper environment variables under perl5 directory. I am not sure how to do that. Also, every time I unzip a tar file for any module and try to run the install command, it returns an error saying that module's .pm file is not located.

Any suggestions or directions on how I can go about doing this? Thanks

Replies are listed 'Best First'.
Re: Installing CPAN without root access
by McA (Priest) on Sep 10, 2013 at 15:19 UTC


    the solution depends heavily on the question whether you want to stick to the system's perl installation or if you want a current Perl version too.

    If you say: Hey, I start by own directory tree for modules why should I not also install a perl for my own, than have a look at (App::perlbrew)

    If you say: No, please, I just want some modules on my own, than have a look at local::lib and for nice installation to App::cpanminus.

    UPDATE: I forgot something. The local::lib thing is meanwhile integrated into the App::perlbrew. So you can think of the App::perlbrew way as a kind of superset.


      I tried installing App::perlbrew but I keep getting error with the curl command they have provided on the website that curl couldn't connect to host. Thanks for your help though

        but I keep getting error with the curl command they have provided on the website that curl couldn't connect to host.

        And then what happened?

        You probably have an HTTP proxy on your network. Set it in the http_proxy variable. Check the curl man page.
Re: Installing CPAN without root access
by keszler (Priest) on Sep 10, 2013 at 15:46 UTC
Use cpanm and local::lib
by dolmen (Beadle) on Sep 11, 2013 at 14:55 UTC
    $ PATH="$PATH:~/perl5/bin" $ export PERL5LIB=~/perl5/lib/perl5 $ export PERL_MB_OPT="--install_base '$HOME/perl5'" $ export PERL_MM_OPT="INSTALL_BASE=$HOME/perl5" $ curl -L | perl - -l ~/perl5 App::cpanminus local:: +lib
    Then adapt your .profile for local::lib and cpanm by adding this line:
    eval $(perl -I$HOME/perl5/lib/perl5 -Mlocal::lib)
    Now you can just do: cpanm any-module

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://1053274]
Approved by NetWallah
Front-paged by NetWallah
[Corion]: Hmm. I think overnight I decided on simplifying some code. I have plugin classes that do data import (.csv, .yml, .json) and for that create objects on which then ->load() is called. But YAML::XS doesn't have an object, so I wrote my own wrapper.
[Corion]: This evening, I'll kill that wrapper again, and just call LoadFile() in the plugin class directly instead of creating a go-between object for no real gain.
[Corion]: Writing these import plugins was really nice though - in about 2 hours, I had imports for CSV, YAML and JSON, and adding XLS(X), SQLite (or DBI) data sources is also trivial. I'm idly wondering about separating the plugin into transport+parser, so ...
[Corion]: ... http:// URLs could be retrieved and then parsed, but I think that that would be overkill for a toy static site generator ;)

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (7)
As of 2018-05-22 11:01 GMT
Find Nodes?
    Voting Booth?