模块问题

模块问题

模块问题
自己写了modules,要调用,程序前需use lib 加路径
use module

但是,当把模块考到另一台机器上运行时,就又得改路径了。为了避免这个应该怎么做啊?谢谢各位!!
module
引自Oriented Object Perl:

Choose the standard library directory under which you want the module to reside. You
may have to create such a directory if this is your first personal module. Typically, such a
directory lives under your home directory. For example, on UNIX, you might create a
subdirectory called ~/lib/perl5. Under MacOS you might set up the folder
Users:Applications:MacPerl ƒ:lib:my modules. For Windows, you might use the directory
C:\USERS\DAMIAN\PERLLIB.

2 Tell Perl of the existence of your directory. If you want to permanently inform Perl of
the new module directory, you can add the path name to the colon-separated list stored
in the shell variable PERL5LIB:
% PERL5LIB="${PERL5LIB}:/users/damian/lib/perl5" # UNIX sh shell
% export PERL5LIB

(assuming you’re working on an operating system that has such things), or add the path
to the appropriate list in the Perl application’s preferences (when using MacPerl, for
example), or you can invoke Perl with the -I<pathname> option.
On the other hand, if you only want to add the directory for a particular program, you
can push a string containing the full path onto the array @INC (in a BEGIN block at the
start of your program):
#! /usr/local/bin/perl -w
BEGIN { push @INC, "/users/damian/lib/perl5" }
使用 FindBin 模块。--<.
使用 FindBin 模块。

例如

use FindBin qw($Bin);
use lib "$Bin/../lib";

$Bin 是你的当前程序所在的目录。有了它,你就不用担心模块的具体路径, 通过 $Bin 来实现相对路径。

另外,这里是 bioperl 版,非主题的问题请到相关的版里问。