Is there a way to avoid adding the Perl version number to the "use lib" line for Perl modules in non-standard places?

I'm trying to install some Perl modules in a non-standard place, let it /non/standard/location. I used

perl Makefile.PL PREFIX=/non/standard/location
make;make install

to install them.

In a script that uses a module, it seems necessary to specify a long path to the directory, including the version of Perl, for example:

#!/usr/local/bin/perl
use lib '/non/standard/location/lib/perl5/site_perl/5.8.9/';
use A::B;

Is there any one use libor other statement that I can use that is not so long and verbose, and which does not include the actual version of Perl, so that I do not have to go back and edit this program if the version of Perl is updated?

+3
source share
2 answers

, , , .

perl Makefile.PL --no-manpages --skipdeps PREFIX=/non/system/location INSTALLSITELIB=/non/system/location/lib INSTALLSITEBIN=/non/system/location/bin INSTALLMAN1DIR=/non/system/location/man/man1 INSTALLMAN3DIR=/non/system/location/man/man3

. --no-manpages, INSTALLMAN1DIR .

0

, , local::lib? perl, use local::lib. :

use lib glob '~/perl5/lib/perl5';
use local::lib;

Thats, , - , Windows, . , script (.bashrc, SetEnv ..), use lib glob, PERL5LIB.

+5

Source: https://habr.com/ru/post/1750616/


All Articles