我通过cpan安装了一个perl模块。但我该如何使用它?

时间:2013-05-25 19:53:39

标签: linux perl cygwin cpan log4perl

经过多次问题,我设法让cpancygwin中工作 我做了:cpan[2]> i Log::Log4perl它似乎有效。即它下载了一些东西:

cpan[2]> i Log::Log4perl  
Fetching with LWP:  
http://cpan.localhost.net.ar/authors/01mailrc.txt.gz  
Going to read '/home/jsmith/.cpan/sources/authors/01mailrc.txt.gz'  
............................................................................DONE  
Fetching with LWP:  
http://cpan.localhost.net.ar/modules/02packages.details.txt.gz  
Going to read '/home/jsmith/.cpan/sources/modules/02packages.details.txt.gz'    
  Database was generated on Mon, 13 May 2013 17:53:03 GMT  
..............  
  New CPAN.pm version (v2.00) available.  
  [Currently running version is v1.960001]  
  You might want to try  
    install CPAN  
    reload cpan  
  to both upgrade CPAN.pm and run the new version without leaving  
  the current session.  


..............................................................DONE  
Fetching with LWP:  
http://cpan.localhost.net.ar/modules/03modlist.data.gz  
Going to read '/home/jsmith/.cpan/sources/modules/03modlist.data.gz'  
............................................................................DONE  
Going to write /home/akis/.cpan/Metadata  
Module id = Log::Log4perl  
    DESCRIPTION  Log4j implementation in Perl  
    CPAN_USERID  MSCHILLI (Michael Schilli <m@perlmeister.com>)  
    CPAN_VERSION 1.41  
    CPAN_FILE    M/MS/MSCHILLI/Log-Log4perl-1.41.tar.gz  
    DSLIP_STATUS ampOp (alpha,mailing-list,perl,object-oriented,Standard-Perl)  
    INST_FILE    (not installed)  

所以现在我有以下简单的脚本:

#!/usr/bin/perl  

use strict;  
use warnings;  

use Log::Log4perl qw(:easy);  

当我尝试运行它时,我得到:

Can't locate Log/Log4perl.pm in @INC

我在~/.cpan下搜索了Log4perl.pm,但我找不到它。为什么?没有cpan安装它吗?我还需要做点什么吗?

1 个答案:

答案 0 :(得分:4)

cpan i提供有关套餐的信息。

使用cpan install ...安装软件包。

(或输入帮助帮助......)