还可以考虑 PAR::Packer

比如说,先在某台有网络的机器上装好一个模块:Statistics::Basic
$ pp -B -p -o stat-basic-all.par -e 'use Statistics::Basic qw(:all)'
$ unzip -l stat-basic-all.par | head
Archive:  stat-basic-all.par
  Length      Date    Time    Name
---------  ---------- -----   ----
        0  2010-09-16 11:56   lib/
        0  2010-09-16 11:56   script/
    21749  2010-09-16 11:56   MANIFEST
      225  2010-09-16 11:56   META.yml
     5428  2010-09-16 11:56   lib/AutoLoader.pm
     8092  2010-09-16 11:56   lib/B.pm
     1477  2010-09-16 11:56   lib/Carp.pm

然后把 par 文件拷贝到目标机器上(那台机器需要预先安装 PAR)
$ perl -MPAR=./stat-basic-all.par -MStatistics::Basic=:all -le 'print
median( 1,2,3 )'
2

这样以后只要在程序引用此模块之前加上 use PAR qw(./stat-basic-all.par) 就好了。

2010/9/16 Robincui <[email protected]>

> 我的方法是:
> 在有外网机器上cpan安装个http proxy模块,写2行代码跑起来
> 没外网机器cpan指定前边的http proxy,依赖问题就解决了
>
> 发自我的 iPad
>
> 在 2010-9-14,8:36,rochelle hsu <[email protected]> 写到:
>
> PERL有啥好的模块安装方法不?(不能上网的主机)。碰到这种依赖关系一堆的模块,安装是个头痛的问题。
>
> 2010/9/13 Qiang (James) < <[email protected]>[email protected]>
>
>> On 09/13/2010 08:49 PM, ZHANG Jiaqiang A wrote:
>> > 大家好,
>> > 求高手给出出主意
>> > 我想安装Log-Dispatch-2.26,然后被告知缺少Params::Validate,安装Params-
>> > Validate-0.95,缺少Module::Build,安装Module-Build-0.3607,被告知缺少
>> > ExtUtils::ParseXS,安装ExtUtils-ParseXS-2.2206,make test的时候出错。
>> > 这是台机房里的Solaris server,无法上网。只能把各个软件从CPAN上下载
>> > 了,1)perlgcc Makefile.PL 2)make 3)make test 4) make install。
>> >
>>
>> 你可以在能上网的相同环境的系统里 CPAN 下载,安装。然后再复制到你这个系统
>> 里,这样会省事不少。
>>
>> 至于这个模块 make test 的问题,你可以尝试跳过 make test,直接 make
>> install。 或者看一下具体 t/more.t 里的那个 test 没有通过,再尝试解决。
>>
>> 另外,(可能没有多大关系)我在 Ubuntu Lucid 里手动装了下这个模块,没问题。
>>
>> >     # make test
>> >     PERL_DL_NONLAZY=1 /usr/perl5/5.8.4/bin/perl
>> >     "-MExtUtils::Command::MM" "-e" "test_harness(0, 'blib/lib',
>> >     'blib/arch')" t/*.t
>> >     t/basic.t .. ok
>> >     t/more.t ... 1/25 # Looks like you planned 25 tests but ran 10.
>> >     t/more.t ... Dubious, test returned 255 (wstat 65280, 0xff00)
>> >     Failed 15/25 subtests
>> >     (less 8 skipped subtests: 2 okay)
>> >     t/usage.t .. ok
>> >     Test Summary Report
>> >     -------------------
>> >     t/more.t (Wstat: 65280 Tests: 10 Failed: 0)
>> >     Non-zero exit status: 255
>> >     Parse errors: Bad plan. You planned 25 tests but ran 10.
>> >     Files=3, Tests=44, 2 wallclock secs ( 0.12 usr 0.03 sys + 1.20 cusr
>> >     0.12 csys = 1.47 CPU)
>> >     Result: FAIL
>> >     Failed 1/3 test programs. 0/44 subtests failed.
>> >     *** Error code 29
>> >     make: Fatal error: Command failed for target `test_dynamic'
>>
>> Qiang
>>
>> --
>> 您收到此邮件是因为您订阅了 Google 网上论坛的“PerlChina Mongers 讨论组”论坛。
>> 要向此网上论坛发帖,请发送电子邮件至 <[email protected]>[email protected]
>> 。
>> 要取消订阅此网上论坛,请发送电子邮件至 <perlchina%[email protected]>
>> [email protected]。
>> 若有更多问题,请通过 <http://groups.google.com/group/perlchina?hl=zh-CN>
>> http://groups.google.com/group/perlchina?hl=zh-CN 访问此网上论坛。
>>
>>
>  --
> 您收到此邮件是因为您订阅了 Google 网上论坛的“PerlChina Mongers 讨论组”论坛。
> 要向此网上论坛发帖,请发送电子邮件至 [email protected]。
> 要取消订阅此网上论坛,请发送电子邮件至 [email protected]。
> 若有更多问题,请通过 http://groups.google.com/group/perlchina?hl=zh-CN 访问此网上论坛。
>
>  --
> 您收到此邮件是因为您订阅了 Google 网上论坛的“PerlChina Mongers 讨论组”论坛。
> 要向此网上论坛发帖,请发送电子邮件至 [email protected]。
> 要取消订阅此网上论坛,请发送电子邮件至 
> [email protected]<perlchina%[email protected]>
> 。
> 若有更多问题,请通过 http://groups.google.com/group/perlchina?hl=zh-CN 访问此网上论坛。
>

-- 
您收到此邮件是因为您订阅了 Google 网上论坛的“PerlChina Mongers 讨论组”论坛。
要向此网上论坛发帖,请发送电子邮件至 [email protected]。
要取消订阅此网上论坛,请发送电子邮件至 [email protected]。
若有更多问题,请通过 http://groups.google.com/group/perlchina?hl=zh-CN 访问此网上论坛。

回复