开发者

Where are perl modules located in archlinux

Im trying to find perl modules, such as strict and warnings, but i cant find them... btw im actual开发者_如何学Goly using archlinux, i tried using

whereis

but it throws nothing.


If the module has POD documentation embedded (which most do), the following will display its location:

perldoc -l Some::Module   (Lowercase "L" for "location")

Otherwise, you can use

perl -E'use Some::Module; say $INC{"Some/Module.pm"};'

You might be interested in identifying all the locations in which your Perl searches for modules. If so, look at the contents of @INC. You can use

perl -V                 (Uppercase "V")

or

perl -E'say for @INC;'

You may also be interested in Devel::Modlist. The following will lists the path to all the modules used (directly or indirectly) by a script or module:

perl -d:Modlist=path some_script.pl

perl -d:Modlist=path -e'use Some::Module;'

Without =path, it returns the versions of all the modules.


To find an individual module:

perldoc -l warnings

All modules are under @INC directories:

perl -V

See also: Find installed Perl modules matching a regular expression


The %INC hash holds the on-disk locations of loaded modules, keyed by the package name. You can step through the keys of %INC and print out the associated value. For example:

$ perl -MData::Dump -e 'print "$_: $INC{$_}\n" foreach keys %INC'

(I loaded Data::Dump so that at least one module would be pulled in for sure. You don't have to load that specific module yourself.)

Also, the @INC array holds the include paths that perl searches for modules in, so you can always do:

$ perl -E 'say foreach @INC'

To find all the default include paths.


Since you are using a Linux distribution, the native package manager is the most suitable tool. In this case, it's highly recommend to use pacman for such a task:

pacman -Ql perl | egrep '(strict|warnings).pm'
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜