perl模块的安装,查询
生活随笔
收集整理的這篇文章主要介紹了
perl模块的安装,查询
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
perl模塊的安裝,查詢
linux下cpan安裝:# perl -MCPAN -e shell ? ? ? ? ? ? // 一路回車配置cpan,個別地方需要輸入cpan> install 模塊名
以后安裝就可以:
# perl -MCPAN -e 'install 模塊名'
windows下ActivePerl安裝:直接用Perl Packge Manager圖形安裝就可以了
查詢安裝好的模塊:當你需要使用模個模塊,不知道是不是安裝了的時候,可以使用下面的命令查看:# perldoc perllocal有類似下面的東西出來:PERLLOCAL(1) User Contributed Perl Documentation PERLLOCAL(1)
Thu Feb 18 11:24:54 2010: "Module" Digest::HMAC
· "installed into: /usr/lib/perl5/site_perl/5.8.8"
· "LINKTYPE: dynamic"
· "VERSION: 1.02"
· "EXE_FILES: "
Thu Feb 18 11:24:58 2010: "Module" Net::IP
· "installed into: /usr/lib/perl5/site_perl/5.8.8"
· "LINKTYPE: dynamic"
· "VERSION: 1.25"
· "EXE_FILES: ipcount iptab"
Thu Feb 18 11:29:05 2010: "Module" Config::IniFiles
· "installed into: /usr/lib/perl5/site_perl/5.8.8"
· "LINKTYPE: dynamic"
· "VERSION: 2.56"
· "EXE_FILES: "
另外還可以使用下面的命令:# perl -MConfig::IniFiles -e 1如果不報錯就是已經安裝了.
shell下直接輸入下面命令,可以找到所有已經安裝的模塊.路徑# find `perl -e 'print "@INC"'` -name '*.pm' -print
或者用這個腳本: ?很詳細.http://cpansearch.perl.org/src/MLFISHER/pmtools-1.01/pminst#!/usr/bin/env perl
# pminst -- find modules whose names match this pattern
# tchrist@perl.com
BEGIN { $^W = 1 }
use Getopt::Std qw(getopts);
use File::Find;
getopts('ls') || die "bad usage";
if (@ARGV == 0) {
????????@ARGV = ('.');
}????
die "usage: $0 [-l] [-s] pattern\n" unless @ARGV == 1;
$pattern = shift();
$pattern =~ s,::,/,g;
no lib '.';
use vars qw($opt_l $opt_s);
for $startdir (@INC) {????
????????find(\&wanted, $startdir);
}
sub wanted {
????????if (-d && /^[a-z]/) {????
??# this is so we don't go down site_perl etc too early
??$File::Find::prune = 1;
??return;
????????}
????????return unless /\.pm$/;
????????local $_ = $File::Find::name;
????????($tmpname = $_) =~ s{^\Q$startdir/}{};
????????return unless $tmpname =~ /$pattern/o;
????????if ($opt_l) {????
??s{^(\Q$startdir\E)/}{$1 } if $opt_s;
????????}????
????????else {
??s{^\Q$startdir/}{};????
??s/\.pm$//;
??s{/}{::}g;
??print "$startdir " if $opt_s;
????????}????
????????print $_, "\n";
}????
__END__
=head1 NAME
pminst - find modules whose names match this pattern
=head1 SYNOPSIS
pminst [B<-s>] [B<-l>] [I<pattern>]
=head1 DESCRIPTION
Without argumnets, show the names of all installed modules.????Given a
pattern, show all module names that match it.????The B<-l> flag will show
the full pathname.????The B<-s> flag will separate the base directory from
@INC from the module portion itself.
=head1 EXAMPLES
????????$ pminst
????????(lists all installed modules)
????????$ pminst Carp
????????CGI::Carp
????????Carp
????????$ pminst ^IO::
????????IO::Socket::INET
????????IO::Socket::UNIX
????????IO::Select
????????IO::Socket
????????IO::Poll
????????IO::Handle
????????IO::Pipe
????????IO::Seekable
????????IO::Dir
????????IO::File
????????$ pminst '(?i)io'
????????IO::Socket::INET
????????IO::Socket::UNIX
????????IO::Select
????????IO::Socket
????????IO::Poll
????????IO::Handle
????????IO::Pipe
????????IO::Seekable
????????IO::Dir
????????IO::File
????????IO
????????Pod::Functions
????The -s flag provides output with the directory separated
????by a space:
????????$ pminst -s | sort +1
????????(lists all modules, sorted by name, but with where they????
???????? came from)
????????$ oldperl -S pminst -s IO
????????/usr/lib/perl5/i386-linux/5.00404 IO::File
????????/usr/lib/perl5/i386-linux/5.00404 IO::Handle
????????/usr/lib/perl5/i386-linux/5.00404 IO::Pipe
????????/usr/lib/perl5/i386-linux/5.00404 IO::Seekable
????????/usr/lib/perl5/i386-linux/5.00404 IO::Select
????????/usr/lib/perl5/i386-linux/5.00404 IO::Socket
????????/usr/lib/perl5/i386-linux/5.00404 IO
????????/usr/lib/perl5/site_perl LWP::IO
????????/usr/lib/perl5/site_perl LWP::TkIO
????????/usr/lib/perl5/site_perl Tk::HTML::IO
????????/usr/lib/perl5/site_perl Tk::IO
????????/usr/lib/perl5/site_perl IO::Stringy
????????/usr/lib/perl5/site_perl IO::Wrap
????????/usr/lib/perl5/site_perl IO::ScalarArray
????????/usr/lib/perl5/site_perl IO::Scalar
????????/usr/lib/perl5/site_perl IO::Lines
????????/usr/lib/perl5/site_perl IO::WrapTie
????????/usr/lib/perl5/site_perl IO::AtomicFile
????The -l flag gives full paths:
????????$ filsperl -S pminst -l Thread
????????/usr/local/filsperl/lib/5.00554/i686-linux-thread/Thread/Queue.pm
????????/usr/local/filsperl/lib/5.00554/i686-linux-thread/Thread/Semaphore.pm
????????/usr/local/filsperl/lib/5.00554/i686-linux-thread/Thread/Signal.pm
????????/usr/local/filsperl/lib/5.00554/i686-linux-thread/Thread/Specific.pm
????????/usr/local/filsperl/lib/5.00554/i686-linux-thread/Thread.pm
=head1 AUTHOR and COPYRIGHT
Copyright (c) 1999 Tom Christiansen
This is free software.????You may modify it and distribute it????
under Perl's Artistic Licence.????Modified versions must be
clearly indicated.
最后一個腳本,是查找你安裝的所有第三方模塊及其版本號:#!/usr/bin/perl????
use strict;
use ExtUtils::Installed;
my $inst= ExtUtils::Installed->new();????
my @modules = $inst->modules();????
foreach(@modules)
{
????????????????my $ver = $inst->version($_) || "???";????
????????????????printf("%-12s --????%s\n", $_, $ver);
}
exit 0;
windows下還是那個東西,圖形的.
linux下cpan安裝:# perl -MCPAN -e shell ? ? ? ? ? ? // 一路回車配置cpan,個別地方需要輸入cpan> install 模塊名
以后安裝就可以:
# perl -MCPAN -e 'install 模塊名'
windows下ActivePerl安裝:直接用Perl Packge Manager圖形安裝就可以了
查詢安裝好的模塊:當你需要使用模個模塊,不知道是不是安裝了的時候,可以使用下面的命令查看:# perldoc perllocal有類似下面的東西出來:PERLLOCAL(1) User Contributed Perl Documentation PERLLOCAL(1)
Thu Feb 18 11:24:54 2010: "Module" Digest::HMAC
· "installed into: /usr/lib/perl5/site_perl/5.8.8"
· "LINKTYPE: dynamic"
· "VERSION: 1.02"
· "EXE_FILES: "
Thu Feb 18 11:24:58 2010: "Module" Net::IP
· "installed into: /usr/lib/perl5/site_perl/5.8.8"
· "LINKTYPE: dynamic"
· "VERSION: 1.25"
· "EXE_FILES: ipcount iptab"
Thu Feb 18 11:29:05 2010: "Module" Config::IniFiles
· "installed into: /usr/lib/perl5/site_perl/5.8.8"
· "LINKTYPE: dynamic"
· "VERSION: 2.56"
· "EXE_FILES: "
另外還可以使用下面的命令:# perl -MConfig::IniFiles -e 1如果不報錯就是已經安裝了.
shell下直接輸入下面命令,可以找到所有已經安裝的模塊.路徑# find `perl -e 'print "@INC"'` -name '*.pm' -print
或者用這個腳本: ?很詳細.http://cpansearch.perl.org/src/MLFISHER/pmtools-1.01/pminst#!/usr/bin/env perl
# pminst -- find modules whose names match this pattern
# tchrist@perl.com
BEGIN { $^W = 1 }
use Getopt::Std qw(getopts);
use File::Find;
getopts('ls') || die "bad usage";
if (@ARGV == 0) {
????????@ARGV = ('.');
}????
die "usage: $0 [-l] [-s] pattern\n" unless @ARGV == 1;
$pattern = shift();
$pattern =~ s,::,/,g;
no lib '.';
use vars qw($opt_l $opt_s);
for $startdir (@INC) {????
????????find(\&wanted, $startdir);
}
sub wanted {
????????if (-d && /^[a-z]/) {????
??# this is so we don't go down site_perl etc too early
??$File::Find::prune = 1;
??return;
????????}
????????return unless /\.pm$/;
????????local $_ = $File::Find::name;
????????($tmpname = $_) =~ s{^\Q$startdir/}{};
????????return unless $tmpname =~ /$pattern/o;
????????if ($opt_l) {????
??s{^(\Q$startdir\E)/}{$1 } if $opt_s;
????????}????
????????else {
??s{^\Q$startdir/}{};????
??s/\.pm$//;
??s{/}{::}g;
??print "$startdir " if $opt_s;
????????}????
????????print $_, "\n";
}????
__END__
=head1 NAME
pminst - find modules whose names match this pattern
=head1 SYNOPSIS
pminst [B<-s>] [B<-l>] [I<pattern>]
=head1 DESCRIPTION
Without argumnets, show the names of all installed modules.????Given a
pattern, show all module names that match it.????The B<-l> flag will show
the full pathname.????The B<-s> flag will separate the base directory from
@INC from the module portion itself.
=head1 EXAMPLES
????????$ pminst
????????(lists all installed modules)
????????$ pminst Carp
????????CGI::Carp
????????Carp
????????$ pminst ^IO::
????????IO::Socket::INET
????????IO::Socket::UNIX
????????IO::Select
????????IO::Socket
????????IO::Poll
????????IO::Handle
????????IO::Pipe
????????IO::Seekable
????????IO::Dir
????????IO::File
????????$ pminst '(?i)io'
????????IO::Socket::INET
????????IO::Socket::UNIX
????????IO::Select
????????IO::Socket
????????IO::Poll
????????IO::Handle
????????IO::Pipe
????????IO::Seekable
????????IO::Dir
????????IO::File
????????IO
????????Pod::Functions
????The -s flag provides output with the directory separated
????by a space:
????????$ pminst -s | sort +1
????????(lists all modules, sorted by name, but with where they????
???????? came from)
????????$ oldperl -S pminst -s IO
????????/usr/lib/perl5/i386-linux/5.00404 IO::File
????????/usr/lib/perl5/i386-linux/5.00404 IO::Handle
????????/usr/lib/perl5/i386-linux/5.00404 IO::Pipe
????????/usr/lib/perl5/i386-linux/5.00404 IO::Seekable
????????/usr/lib/perl5/i386-linux/5.00404 IO::Select
????????/usr/lib/perl5/i386-linux/5.00404 IO::Socket
????????/usr/lib/perl5/i386-linux/5.00404 IO
????????/usr/lib/perl5/site_perl LWP::IO
????????/usr/lib/perl5/site_perl LWP::TkIO
????????/usr/lib/perl5/site_perl Tk::HTML::IO
????????/usr/lib/perl5/site_perl Tk::IO
????????/usr/lib/perl5/site_perl IO::Stringy
????????/usr/lib/perl5/site_perl IO::Wrap
????????/usr/lib/perl5/site_perl IO::ScalarArray
????????/usr/lib/perl5/site_perl IO::Scalar
????????/usr/lib/perl5/site_perl IO::Lines
????????/usr/lib/perl5/site_perl IO::WrapTie
????????/usr/lib/perl5/site_perl IO::AtomicFile
????The -l flag gives full paths:
????????$ filsperl -S pminst -l Thread
????????/usr/local/filsperl/lib/5.00554/i686-linux-thread/Thread/Queue.pm
????????/usr/local/filsperl/lib/5.00554/i686-linux-thread/Thread/Semaphore.pm
????????/usr/local/filsperl/lib/5.00554/i686-linux-thread/Thread/Signal.pm
????????/usr/local/filsperl/lib/5.00554/i686-linux-thread/Thread/Specific.pm
????????/usr/local/filsperl/lib/5.00554/i686-linux-thread/Thread.pm
=head1 AUTHOR and COPYRIGHT
Copyright (c) 1999 Tom Christiansen
This is free software.????You may modify it and distribute it????
under Perl's Artistic Licence.????Modified versions must be
clearly indicated.
最后一個腳本,是查找你安裝的所有第三方模塊及其版本號:#!/usr/bin/perl????
use strict;
use ExtUtils::Installed;
my $inst= ExtUtils::Installed->new();????
my @modules = $inst->modules();????
foreach(@modules)
{
????????????????my $ver = $inst->version($_) || "???";????
????????????????printf("%-12s --????%s\n", $_, $ver);
}
exit 0;
windows下還是那個東西,圖形的.
轉載于:https://blog.51cto.com/jasonyong/276885
總結
以上是生活随笔為你收集整理的perl模块的安装,查询的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 【.Net Micro Framewor
- 下一篇: 人生开关