Locating and printing modules with perldoc


I have recently started using perldoc to access the Perl documentation collection, and can’t believe it took me this long to do so. Perldoc has a slew of nifty options, including “-l” (print the path to a Perl module) to print the full path to a given module:

$ /usr/perl5/5.8.4/bin/perldoc -l Net::DNS

/usr/perl5/site_perl/5.8.4/sun4-solaris-64int/Net/DNS.pm

And “-m” (display the modules Perl code) to display the modules code and pod documentation (if it exists):

$ /usr/perl5/5.8.4/bin/perldoc -m Net::DNS

package Net::DNS;
#
# $Id: DNS.pm 468 2005-07-22 12:12:55Z olaf $
#
use strict;


BEGIN {
eval { require bytes; }
}

If you haven’t used perldoc to access the Perl documentation, I highly recommend doing so. You can get started with perldoc by running perldoc with the argument perldoc (e.g., $perldoc perldoc).

This article was posted by Matty on 2006-07-02 23:07:00 -0400 -0400