개발이야기
perl - lib 경로 관련
준호씨
2018. 8. 1. 21:55
반응형
절대경로
use lib '/Users/junho85/perl-lib';
상대경로
FindBin 모듈 이용
use FindBin;
use lib "$FindBin::Bin/./lib";
perl 모듈 경로
perl -V 해 보면 기본적으로 참조 하는 라이브러리 경로들을 확인 할 수 있다.
@INC:
/Users/junho85/perl5/lib/perl5
/Users/junho85/perl5/perlbrew/perls/perl-5.26.1/lib/site_perl/5.26.1/darwin-2level
/Users/junho85/perl5/perlbrew/perls/perl-5.26.1/lib/site_perl/5.26.1
/Users/junho85/perl5/perlbrew/perls/perl-5.26.1/lib/5.26.1/darwin-2level
/Users/junho85/perl5/perlbrew/perls/perl-5.26.1/lib/5.26.1
.bashrc 나 .bash_profile 같은 곳에 PERL5LIB 경로를 지정 해서 추가 할 수 있다.
export PERL5LIB=/Users/junho85/perl-lib
perl -l
perl -l /Users/junho85/perl-lib
스크립트 실행 할 때 라이브러리 경로를 임시로 추가 해 줄 수 있다.
참고
반응형