====== Installing Perl Modules Centrally ====== Looking for way to install Perl CPAN modules centrally on the JH hub. Found the following steps. - Make personal Perl configuration for use with CPAN - On the command line enter in: perl -MCPAN -e 'mkmyconfig' - When prompted, press enter to allow automatic configuration. - For "What approach do you want?", press Enter or Return to select the default option (local::lib). - Press Enter to let the application automatically choose CPAN mirror sites. - press Enter to add the necessary environment variables to your shell configuration file. - If prompted to run automatic configuration again, press Enter to select [yes]. - You will see output showing the autoconfiguration is complete written to the following directory - /home/username/.cpan/CPAN/MyConfing.pm - When returned to the shell prompt, run the CPAN module; enter: perl -MCPAN -e shell - Configure the CPAN module to install new modules in your home directory: - At the (cpan[1]>) prompt enter: o conf makepl_arg INSTALL_BASE=/home/.hub_local/perl5 - At the next CPAN prompt, enter: o conf commit - At the next CPAN prompt, enter: exit - Modify your environment to use the new library of modules: - Add the following lines to the end of your .bashrc file: export PERL_MM_OPT="INSTALL_BASE=/home/.hub_local/perl5" export PERL5LIB="/home/.hub_local/perl5/lib/perl5:$PERL5LIB" export PATH="/home/.hub_local/perl5/bin:$PATH" eval $(perl -I/home/.hub_local/perl5/lib/perl5 -Mlocal::lib) To install a Perl module run: perl -MCPAN -Mlocal::lib -e 'CPAN::install(Math::Matrix)'\\ To test create a test.pl file and put the following lines in it. #!/usr/bin/perl use strict; use local::lib; use Math::Matrix; Save the file and then execute it. It should return with no errors.