jro*_*way 75
perl -MTime::HiRes -e 'print $INC{"Time/HiRes.pm"}' 要么 perldoc -l Time::HiRes
bri*_*foy 21
您可以使用Perl附带的cpan工具获取模块详细信息:
$ cpan -D Time::HiRes
Time::HiRes
-------------------------------------------------------------------------
High resolution time, sleep, and alarm
J/JH/JHI/Time-HiRes-1.9719.tar.gz
/usr/local/perls/perl-5.10.0/lib/5.10.0/darwin-2level/Time/HiRes.pm
Installed: 1.9711
CPAN: 1.9719 Not up to date
Andrew Main (Zefram) (ZEFRAM)
zefram@fysh.org
Run Code Online (Sandbox Code Playgroud)
它甚至适用于您尚未安装的模块:
$ cpan -D Win32::Process
Win32::Process
-------------------------------------------------------------------------
Interface to Win32 Process functions
J/JD/JDB/Win32-Process-0.14.tar.gz
Installed:
CPAN: 0.14 Not up to date
Jan Dubois (JDB)
jand@activestate.com
Run Code Online (Sandbox Code Playgroud)
我想也许我需要像svn这样的XML选项.
mkl*_*nt0 17
我创建whichpm了一个跨平台的CLI(Linux,OSX,Window),它按模块(包)名称定位已安装的Perl模块,并可选择报告有关它们的信息,包括检测意外重复.
例子
# Locate the Data::Dumper module.
$ whichpm Data::Dumper
/usr/lib/perl/5.18/Data/Dumper.pm
# Locate the Data::Dumper module, and also print
# version information and core-module status.
$ whichpm -v Data::Dumper
Data::Dumper 2.145 core>=5.005 /usr/lib/perl/5.18/Data/Dumper.pm
# Locate the Data::Dumper module and open it in your system's default text
# editor.
$ whichpm -e Data::Dumper
# Look for accidental duplicates of the Foo::Bar module.
# Normally, only 1 path should be returned.
$ whichpm -a Foo::Bar
/usr/lib/perl/5.18/Foo/Bar.pm
./Foo/Bar.pm
# Print the paths of all installed modules.
$ whichpm -a
Run Code Online (Sandbox Code Playgroud)
先决条件:安装了Perl v5.4.50或更高版本的Linux,OSX或Windows.
随着Node.js的或io.js安装,安装软件包,如下所示:
[sudo] npm install whichpm -g
Run Code Online (Sandbox Code Playgroud)
whichpm.chmod +x whichpm.$PATH,例如/usr/local/bin(OSX)或/usr/bin(Linux).如果需要查找脚本实际使用的模块,可以使用perl debuggers M命令:
[ivan@server ~]$ perl -d your_script.pl ... Debugged program terminated. Use q to quit or R to restart, use o inhibit_exit to avoid stopping after program termination, h q, h R or h o to get additional info. DB M 'AutoLoader.pm' => '5.60 from /usr/lib/perl5/5.8.8/AutoLoader.pm' 'Carp.pm' => '1.04 from /usr/lib/perl5/5.8.8/Carp.pm' ...
如果模块具有相同的名称但位于不同的文件夹中,这将有所帮助.