Perl module installs custom paths and uses

Source: Internet
Author: User
Tags install perl perl script

Install Perl modules to a non-custom directory

How does I get Makemaker and Module::build to install to the same place? Module::build, as of 0.28, supports, ways to install to the same location as Makemaker. 1) Use Install_base/--install_base makemaker (as of 6.31) and Module::build (as of 0.28) both can INSTALL to the same lo Cations using the "install_base" concept. See "Install_base" in Extutils::makemaker for details. To get MM and MB to install to the same location simply set install_base in MM and--install_base in MB to the same locati     On. Perl makefile.pl install_base=/whatever perl build.pl--install_base/whatever 2) Use PREFIX/--prefix Module::bui     LD 0.28 added support for--prefix which works like Makemaker ' s prefix. Perl makefile.pl prefix=/whatever Perl build.pl--prefix/whatever

ii Use the module in the custom directory

BEGIN {push (@INC, '/opt/perl/lib ');}

BEGIN {unshift @INC, '/opt/perl/lib ';}

Use Lib '/opt/perl/lib ';

Use Local::lib; # sets up a local lib @ ~/perl5 use local::lib ' ~/foo '; # Same, but ~/foo

# Or ... use findbin; Use Local::lib "$FindBin:: bin/.  /support "; # app-local Support library use Findbin; Use Lib "$FindBin:: bin/. /lib ";

# or use Findbin QW ($Bin); Use Lib "$Bin/.. /lib ";

Three find the installed Module 1. Shell script: Find ' perl-e ' print "@INC" '-name ' *.pm '-print 2. Perl script: #!/usr/bin/perl use strict; Use extutils::installed; My $inst = Extutils::installed->new (); My @modules = $inst->modules (); foreach (@modules) {My $ver = $inst->version ($_) | | “???”; printf ("%-12s-%s\n", $_, $ver); } exit 0;

Finish.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.