Perl模块的维护
来源:互联网 发布:seo sem培训 编辑:程序博客网 时间:2024/06/05 09:27
我们在使用Perl时会用到各种各样的模块,比如,我们常用的DBI、DBD等等。
那么,我们怎样去维护它呢?
1. 下载
我们使用搜索引擎(bing or google, Not recommend baidu),输入“模块名 cpan”即可。
比如,我们要安装"Encode::Locale"模块,
在必应的搜索结果(红色方框圈的既是):
在谷歌的搜索结果(红色方框圈的既是):
点击链接,选择相关版本即可(一般情况下,我们选择最新的版本)。
2. 安装
下载完模块后,我们解压缩、安装。
$tar zxvf xxx.tar.gz
$cd xxx
$perl Makefile.PL
$make
$make test
$make install
注意:有的tar.gz文件会显示“his does not look like a tar archive”提示。
这样的文件(tar.gz)是只包含tar文件的。需要进行两步操作:a)gzip -d xxxx.tar.gz b)tar -xf xxxx.tar
3. 查看已安装模块
我们需要写一个简单的程序来完成。
程序代码如下所示:
testPM.pl
#!/usr/bin/env perl# pmlist - report modules which are installed on your machine# Author: Hinemosuse strict;use warnings;use ExtUtils::Installed;use UNIVERSAL::require;use Getopt::Long;GetOptions( verbose => \my $verbose );my @installed_modules = ExtUtils::Installed->new->modules;for my $module (@installed_modules) { print $module; if ($verbose) { if ($module eq 'Perl') { print "\t$^V"; } else { # suppress some 'inevitable' warnings local $SIG{__WARN__} = sub { }; $module->require; no strict 'refs'; my $v = ${$module . '::VERSION'}; printf "\t%s", defined $v ? $v : 'undetectable' ; } } print "\n";}
执行的结果(我的机器)如下:
Class::Factory::Util
Class::Inspector
Config::General
DBD::mysql
DBI
Encode::Locale
File::Listing
File::ShareDir
- Perl模块的维护
- Perl模块的安装
- 卸载perl的模块
- Perl的HTTP模块
- perl Statistics::Descriptive Perl 的统计模块
- perl需要的模块全集
- Perl DBI模块的例子
- Perl模块的手动安装
- perl的有用内置模块
- perl的LWP模块介绍
- 查看安装的Perl模块
- Perl 的 html 解析模块
- Perl 的 html 解析模块
- 操作excel的perl模块
- Perl 模块 ImageMagick的安装
- perl的File::Tail模块
- perl的Parse::Syslog模块
- 查看安装的Perl模块
- #1045 -Access denied for user 'root'@'localhost' (using password: NO)
- JAVA多线程死锁现象示例展示
- 金山CEO张宏江:2013移动互联网的七个趋势
- MBAlertView 弹出框,hud , block
- 2013年度学习计划,放在博客里面时时的警告自己要坚持。
- Perl模块的维护
- .NET设计模式(2):单件模式(Singleton Pattern)
- SEO优化的六大潜在作用
- VFS 和 MTD
- 女性创业者的自述:创业这一年学到的10大心得
- “金字塔”优化策略:为网站SEO引航定位
- ActionSheetPicker :可以UI 取代表单代码里面写的 UIActionSheet ,更好看
- HTML <meta> 标签
- Objective-C中的锁