Installing CPAN Modules without Root

by
Annika Backstrom
in misc, on 21 October 2011. It is tagged #Web, #perl, and #scripting.

Today I needed to run mysqlhotcopy, but it was failing "undefined symbol: mysql_init" in DBD::mysql. My Perl is rusty at best, and I finally resorted to reinstalling DBI and DBD::mysql using the local user. (I don't have root on this box, and I was under some time constraints.)

Mostly for my own future reference:

  1. Set your home directory as the default CPAN install prefix in ~/.cpan/CPAN/MyConfig.pm: 'makepl_arg' => q[PREFIX=/var/home/mysql]
  2. Export PERL5LIB in ~/.bash_profile (your values may vary): export PERL5LIB=$HOME/lib/perl5/5.8.8:$HOME/lib64/perl5/site_perl/5.8.8

Resources