Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Which cpan modules are the best to read and study?

Tags:

perl

cpan

I've looked into the source code of DBIx::Class recently and found that I don't understand a thing (though I mastered a couple tricks while trying to).

So my question is: which CPAN modules are a must read for someone who wants to learn, and in what order?

like image 645
Dallaylaen Avatar asked Mar 02 '11 21:03

Dallaylaen


People also ask

What is the use of CPAN?

The Comprehensive Perl Archive Network (CPAN) is a repository of over 250,000 software modules and accompanying documentation for 39,000 distributions, written in the Perl programming language by over 12,000 contributors.

How to contribute to CPAN?

To become a CPAN contributor, you don't need to write a new CPAN distribution, you just need to submit a change to an existing distribution that get's accepted by the author.

Where do CPAN modules get installed?

Standard modules are installed in a directory like /usr/lib/perl5, whereas third-party modules are installed in /usr/lib/perl5/site_ perl. If your system manager isn't around or can't be prevailed upon to run the installation, don't worry.


2 Answers

If I were doing the same I’d probably start with the ::Tiny space. I’d expect it to be less distracting—fewer edge cases cluttering things—and more idiomatic—terseness lends itself to Perl idiom—in general.

Then I’d attack the medium–large nodes from this excellent document—Map of the CPAN’s authors (large PDF). Update: Web version. Zoom into the bigger nodes then search on search.cpan.org for them. The largest nodes sometimes represent old-school and while exceptional code exists in the old school, not a lot of good teaching examples do (so I say). Authors like Miyagawa, Kennedy, and Kogman come to mind immediately as worth reviewing. There are plenty of others. Basically any module you see recommended here often, look up the author and poke around his or her other packages, as it were.

like image 91
Ashley Avatar answered Sep 27 '22 01:09

Ashley


I learned quite a bit (tie-ing, platform independent filesystem access, etc) by reading the code for File::chdir. It is also a very handy module to use in your scripts, I use it all the time.

I would also add to bvr's list: read the source for modules that you use frequently, since you are already familiar with their expected behavior, you can more clearly see what is being done to achieve that result.

like image 27
Joel Berger Avatar answered Sep 24 '22 01:09

Joel Berger