perl安装模块

1.cpan

   perl -MCPAN -e shell

   o conf init 可以初始化CPAN

   vi /usr/lib/perl5/5.8.8/CPAN/Config.pm 更改CPAN配置主要是镜像的配置

   163镜像  urllist' => [q[http://mirrors.163.com/cpan/]]

  install Net::Netmask

  就自动安装了

  m  /正则/  可以查看搜索模块

  2.perldoc perllocal查看安装了的模块 但是自带的模块不显示

     perldoc 模块  可以看到模块的使用方式

     查看函数使用方法
    perldoc -f map
    查看模块源代码
    perldoc -m CGI

3.perl的模块搜索路径

   #!/usr/bin/perl
#$\="\n";
$,="\n";
print @INC;
print "\n";

/usr/lib64/perl5/site_perl/5.8.8/x86_64-linux-thread-multi
/usr/lib/perl5/site_perl/5.8.8
/usr/lib/perl5/site_perl
/usr/lib64/perl5/vendor_perl/5.8.8/x86_64-linux-thread-multi
/usr/lib/perl5/vendor_perl/5.8.8
/usr/lib/perl5/vendor_perl
/usr/lib64/perl5/5.8.8/x86_64-linux-thread-multi
/usr/lib/perl5/5.8.8
.

所以如果写好的模块放在当前目录下就能用

FILE/Find.pm

可以用 use FILE::Find来调用

Config.pm:




# This is CPAN.pm's systemwide configuration file. This file provides
# defaults for users, and the values can be changed in a per-user
# configuration file. The user-config file is being looked for as
# ~/.cpan/CPAN/MyConfig.pm.

$CPAN::Config = {
  'build_cache' => q[10],
  'build_dir' => q[/root/.cpan/build],
  'cache_metadata' => q[1],
  'cpan_home' => q[/root/.cpan],
  'dontload_hash' => {  },
  'ftp' => q[/usr/kerberos/bin/ftp],
  'ftp_proxy' => q[],
  'getcwd' => q[cwd],
  'gpg' => q[/usr/bin/gpg],
  'gzip' => q[/bin/gzip],
  'histfile' => q[/root/.cpan/histfile],
  'histsize' => q[100],
  'http_proxy' => q[],
  'inactivity_timeout' => q[0],
  'index_expire' => q[1],
  'inhibit_startup_message' => q[0],
  'keep_source_where' => q[/root/.cpan/sources],
  'links' => q[/usr/bin/links],
  'make' => q[/usr/bin/make],
  'make_arg' => q[],
  'make_install_arg' => q[],
  'makepl_arg' => q[],
  'ncftp' => q[],
  'ncftpget' => q[],
  'no_proxy' => q[],
  'pager' => q[/usr/bin/less],
  'prerequisites_policy' => q[ask],
  'scan_cache' => q[atstart],
  'shell' => q[/bin/bash],
  'tar' => q[/bin/tar],
  'term_is_latin' => q[0],
  'unzip' => q[/usr/bin/unzip],
  'urllist' => [q[http://mirrors.163.com/cpan/]],
  'wget' => q[/usr/bin/wget],
};
1;
__END__

你可能感兴趣的:(perl)