Perl模块的安装、卸载以及检查已安装的模块

Perl模块的安装、卸载以及检查已安装的模块,第1张

概述How do I install Perl modules? installing a new module can be as simple as typing perl -MCPAN -e 'installChocolate::Belgian'. The CPAN.pm documentation has more completeinstructions on how to use this

How do I install Perl modules?

installing a new module can be as simple as tyPing perl -MCPAN -e 'installChocolate::Belgian'. The CPAN.pm documentation has more completeinstructions on how to use this convenIEnt tool. If you are uncomfortable withhaving something take that much control over your software installation,or itotherwise doesn't work for you,the perlmodinstall documentation covers moduleinstallation for UNIX,windows and Macintosh in more familiar terms.

Finally,if you're using ActivePerl on windows,the PPM (Perl Package Manager) has much of the samefunctionality as CPAN.pm.


How do I remove installed Perl modules?

By using the ExtUtils::Installed and ExtUtils::Packlist modules that come with Perl asin the example below. There is also a more elaborate example in theExtUtils::PackList man page.

#!/usr/local/bin/perl -w

use ExtUtils::PackList;

use ExtUtils::Installed;

$ARGV[0] or dIE "Usage: $0Module::name\n";

my $mod = $ARGV[0];

my $inst =ExtUtils::Installed->new();

     foreachmy $item (sort($inst->files($mod))) {

             print "removing $item\n";

             unlink $item;

          }

      my$packfile = $inst->packList($mod)->packList_file();

          print "removing $packfile\n";

          unlink $packfile;

How do I find out what modules are already installed on my system?

perldoc perllocal

Each time a module is installed on your system,itappends information like the following to a file called perllocal.pod which can be found in /usr/local/lib/perl5/version number/architecture/ or something akin to that. The path for your specificinstallation is in your @INC which you can divine with perl -V.

=head2 Wed May 12 13:42:53 1999: C<Module>L<Data::Dumper>

=over 4

=item *

C<installed into: /usr/local/lib/perl5/5.00503>

=item *

C<linkTYPE: dynamic>

=item *

C<VERSION: 2.101>

=item *

C<EXE_fileS: >

=back

Each entry includes the Module name,date and time it wasinstalled,where it was installed,linktype [ static or dynamic ],version andexecutables,if any,included with the module.

Use the ExtUtils::Installed module

ExtUtils::Installed provIDes a standard way tofind out what core and module files have been installed. It uses theinformation stored in .packList files created during installation to provIDethis information. In addition it provIDes facilitIEs to classify the installedfiles and to extract directory information from the .packList files.

 

#!/usr/local/bin/perl

use ExtUtils::Installed;

my $instmod =ExtUtils::Installed->new();

foreach my $module($instmod->modules()) {

my $version =$instmod->version($module) || "???";

       print "$module -- $version\n";

}

produces the following List of modules and their version

Apache::DBI -- 0.87

Apache::DBILogConfig -- 0.01

Apache::DBILogger -- 0.93

AppConfig -- 1.52

Archive::Tar -- 0.22

BerkeleyDB -- 0.06

CGI -- 2.74

CPAN -- 1.59

CPAN::WAIT -- 0.27

Catalog -- 1.00

Compress::Zlib -- 1.11

Config::Inifiles -- 2.14

Convert::BER -- 1.26

Coy -- ???

Crypt::Rot13 -- 0.04

Crypt::SSLeay -- 0.16

DBI -- 1.14

[.....]

 转载自http://hi.baidu.com/tkocn/blog/item/98bdeb07757cb8ce7a89477b.html

总结

以上是内存溢出为你收集整理的Perl模块安装卸载以及检查已安装的模块全部内容,希望文章能够帮你解决Perl模块的安装、卸载以及检查已安装的模块所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/langs/1294057.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-06-10
下一篇 2022-06-10

发表评论

登录后才能评论

评论列表(0条)

保存