This shows you the differences between two versions of the page.
Next revision Both sides next revision | |||
usage_on_fly [2012/02/23 18:09] k2patel created |
usage_on_fly [2012/02/23 18:19] k2patel |
||
---|---|---|---|
Line 5: | Line 5: | ||
==== To install Modules Locally ==== | ==== To install Modules Locally ==== | ||
Best way to install local module is to install module "local::lib".\\ | Best way to install local module is to install module "local::lib".\\ | ||
- | [[http://search.cpan.org/~apeiron/local-lib/ | CPAN Local::lib ]] | + | [[http://search.cpan.org/~apeiron/local-lib/ | CPAN Local::lib ]]\\ |
But you can also manually do it. | But you can also manually do it. | ||
+ | |||
+ | **First export your username** | ||
<code bash> | <code bash> | ||
+ | export username=ketan | ||
+ | </code> | ||
+ | |||
+ | **create the .cpan directories** | ||
+ | |||
+ | <code oobas> | ||
+ | mkdir $HOME/.cpan/ | ||
+ | mkdir $HOME/.cpan/CPAN/ | ||
+ | # This is so it ignores the global CPAN config | ||
+ | |||
+ | echo "\$CPAN::Config->{cpan_home}='/home/$username/.cpan';" > /home/$username/.cpan/CPAN/MyConfig.pm | ||
+ | </code> | ||
+ | Then Execute a CPAN shell | ||
+ | |||
+ | <code oobas> | ||
+ | perl -MCPAN -e shell | ||
+ | OR | ||
+ | cpan | ||
+ | </code> | ||
+ | Then when in the shell type: | ||
+ | |||
+ | <code oobas> | ||
+ | o conf init | ||
+ | </code> | ||
+ | to reconfigure CPAN, replace all \*/root/.cpan/\* with /home/$username/.cpan/* | ||
+ | |||
+ | Then edit ''/home/$username/.cpan/CPAN/MyConfig.pm'' and change the makepl_arg so that it has your PREFIX line as well: | ||
+ | |||
+ | <code oobas> | ||
+ | 'makepl_arg' => q[INSTALLDIRS=site PREFIX=/home/$username/perl/], | ||
+ | </code> | ||
+ | Finally the env variable PERL5LIB needs to point to the new module installation paths: | ||
+ | |||
+ | <code oobas> | ||
+ | export PERL5LIB="/home/$user/perl/share/perl/5.8.4/:/home/$user/perl/lib/perl/5.8.4/"; | ||
+ | </code> | ||
+ | and then you should be able to use CPAN to install modules. | ||
+ | |||
+ | I then modified the Oddmuse script so that the new module install directory was in @INC so that Oddmuse could pick up the modules. Put the following line somewhere near the top | ||
+ | |||
+ | <code oobas> | ||
+ | push @INC,qw(/home/$user/perl/share/perl/5.8.4/ /home/$user/perl/lib/perl/5.8.4/); | ||
+ | </code> | ||
+ | |||
+ |