Install custom paths and use the Perl Module

Source: Internet
Author: User
Tags perl script

1. Install the Perl module to a non-custom directory

 

How do I get makemaker and module: build to install to the same place? Module: build, as of 0.28, supports two ways to install to the same location as makemaker.1) Use install_base/-- install_basemakemaker (as of 6.31) and module :: build (as of 0.28) both can install to the same locations 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 location. perl makefile. PL install_base =/whatever Perl build. pl -- install_base/whatever2) Use prefix/-- prefixmodule: Build 0.28 added support for -- prefix which works like makemaker's prefix. perl makefile. PL prefix =/whatever Perl build. pl -- prefix/whatever

 

 

 

2. Use modules 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 ~ /Perl5use local: Lib '~ /Foo '; # Same, ~ /Foo

 

# Or... use findbin; use local: lib "$ findbin: Bin /.. /support "; # app-local support libraryuse findbin; Use lib" $ findbin: Bin /.. /lib ";

 

# Oruse findbin QW ($ bin); Use lib "$ bin/../lib ";

 

3. Find the installed modules

1. shell script: Find 'perl-e' print "@ INC" ''-name' *. PM '-print2. Perl script :#! /Usr/bin/perluse strict; Use extutils: installed; my $ inst = extutils: installed-> New (); my @ modules = $ inst-> modules (); foreach (@ modules) {my $ ver = $ inst-> Version ($ _) | "? "; Printf ("%-12 S-% s \ n", $ _, $ ver);} exit 0;

 

Complete!
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.