Thursday, April 8, 2010

Finding the Location of Perl Modules

There are (at least) two simple ways of finding the location on the file system of a perl module. The first is to use the perldoc command.
$ perldoc -l CPAN
$ perldoc -l Pod::Perldoc
No documentation found for "Pod::Perldoc".
The second way is more robust, but also a little more verbose. Just use a perl one liner that uses the module and then looks up the path in the %INC variable.
$ perl -MCPAN -e 'print $INC{""}, "\n"'
$ perl -MPod::Perldoc -e 'print $INC{"Pod/"}, "\n"'

No comments:

Post a Comment