Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I tell cpan to change the target for the module installation?

Tags:

module

perl

cpan

When I installed perl from the source the first nice surprise was that without doing something all module installed from now on were available to the new perl. Since I didn't find one module on cpan that comes with my OS I have to use for some scripts the onboard-perl. For one of these scripts I would like to install Text::Format or Text::Autoformat (didn't find the docu for that module on cpan). My question: how can I tell cpan to install the module this one time for the OS-distro-perl?

like image 346
sid_com Avatar asked Nov 15 '22 12:11

sid_com


1 Answers

There isn't a special way to tell cpan to install modules in a new location for just the one invocation. That feature, however, is on my to do list, along with local::lib support. I truly understand your pain and want the same feature. I just need the time (or the patch) to make it work.

Until then, you have to enter the CPAN.pm shell and change the values for mbuild_arg and makefilepl_arg as noted in perlfaq8: How do I keep my own module directory?:


When you build modules, tell Perl where to install the modules.

For Makefile.PL-based distributions, use the INSTALL_BASE option when generating Makefiles:

perl Makefile.PL INSTALL_BASE=/mydir/perl

You can set this in your CPAN.pm configuration so modules automatically install in your private library directory when you use the CPAN.pm shell:

% cpan
cpan> o conf makepl_arg INSTALL_BASE=/mydir/perl
cpan> o conf commit

For Build.PL-based distributions, use the --install_base option:

perl Build.PL --install_base /mydir/perl

You can configure CPAN.pm to automatically use this option too:

% cpan
cpan> o conf mbuild_arg "--install_base /mydir/perl"
cpan> o conf commit
like image 126
brian d foy Avatar answered Dec 23 '22 17:12

brian d foy