wuchang
wuchang

Reputation: 3079

How can I know where a Perl module is installed?

I want to know where the IO::Socket::SSL module, or more specifically, where the file SSL.pm is located. I already know that I have installed IO::Socket::SSL because use IO::Socket::SSL works.

Upvotes: 3

Views: 1994

Answers (4)

Miguel Prz
Miguel Prz

Reputation: 13792

I always use something like this:

%> perl -MIO::Socket::SSL -e 'print $INC{"IO/Socket/SSL.pm"}';

and you get the path or an error if the module it is not installed in a proper path where perl can get it.

If you want to see if that module was installed:

%> perl -MIO::Socket::SSL -e 1

if you don't get any error, it's installed.

Sometimes it's important to see the version number of the installed package:

%> perl -MIO::Socket::SSL -e 'print $IO::Socket::SSL::VERSION';

Or, if you are working on Windows, you have to use double-quotes:

C:\> perl -MIO::Socket::SSL -e "print $IO::Socket::SSL::VERSION";

Upvotes: 6

plusplus
plusplus

Reputation: 2030

The pmtools package provides an assortment of useful command line utils for finding where a package is installed (pmpath), what version it is at (pmvers), etc

Upvotes: 1

doubleDown
doubleDown

Reputation: 8408

This should work

perldoc -l 'IO::Socket::SSL'

or alternatively in cmd.exe

perldoc -l "IO::Socket::SSL"

-l switch means "Display the module's file name". I find that it shows the fully qualified path to a module or (if applicable) to the module's external POD which is in the same directory as the module itself.

Upvotes: 4

Sunny Patel
Sunny Patel

Reputation: 545

You can do:

perl -E'use IO::Socket::SSL; say $INC{"IO/Socket/SSL.pm"};'

But a rule of thumb it most modules are typically in /usr/share/perl5 on ubuntu.

Upvotes: 3

Related Questions