. .

Non-root user install perl modules

  • Finding perl included path
    perl -e "print qq(@INC)"
  • Extend the library path
    • Use PERL5LIB
      PERL5LIB=/home/xxx/myperllib:/another/path/lib; export PERL5LIB
    • Use -I parameter
      > perl -I /home/xxx/myperllib abc.pl
      
    • Add the path into your script
      #!/usr/bin/perl
      use lib "/home/xxx/myperllib";
       
      use MyPerlLibModule;
      
  • Using local::lib to install perl module without root
    • Get the package
      perl Makefile.PL --bootstrap
      make
      make test
      make install
      
    • Setup the environment variable into your shell, you may
      echo 'eval $(perl -I$HOME/perl5/lib/perl5 -Mlocal::lib)' >>~/.bashrc
      
    • Now, you can run perl -MCAPN -eshell to install perl module.