A Tour of the Perl Library
You’ll save an enormous amount of time if you make the effort to familiarize yourself with the Standard Library, because there’s no reason to reinvent those particular wheels. You should be aware, however, that this collection contains a wide range of material. Although some libraries may be extremely helpful, others might be completely irrelevant to your needs. For example, if you’re only writing in 100% pure Perl, those modules that support the dynamic loading of C and C++ extensions aren’t going to help you much.
Perl expects to find library modules somewhere in its library “include” path, @INC. This array specifies the ordered list of
directories Perl searches when you load in some library code using the
keywords do, require, or use. You can easily list out those directories
by calling Perl with the –V switch for Very
Verbose Version information, or with this simple code:
% perl –le "print for @INC"
/usr/local/lib/perl5/site_perl/5.14.2/darwin–2level
/usr/local/lib/perl5/site_perl/5.14.2
/usr/local/lib/perl5/5.14.2/darwin–2level
/usr/local/lib/perl5/5.14.2
.That’s only one sample of possible output. Every installation of Perl uses its own paths. The important thing is that, although contents will vary depending upon your vendor’s and your site’s installation policy, you can rely upon all standard libraries being installed with Perl. That one is from a Perl installed manually. Another Perl on the same system can give a different answer.
% /usr/bin/perl ...Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access