Check whether a Perl module is installed

August 16th, 2005

To check whether a Perl module is installed, use the command:

perl -M<module>

For example:
perl -MCGI

or:

perl -M<module>::<module>::<module>

For example:
perl -MIO::Socket::UNIX

If perl returns a scree of stuff beginning "Can't locate...", then the module isn't installed.

If all you get is a new line, the module is installed - in which case press Ctrl+D to get back to the command prompt.

Leave a comment