Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

Dear fellow perlmonks,

I'm looking for a list of well-written Perl modules.

I think of Perl as a very "literary" language. Between Larry Wall's focus on syntactic convenience and fluidity, the principles of TIMTOWTDI, and the plethora of idioms, Perl is written in a wide range of styles unique to individual authors. There is "Baby Perl" of course -- like the "See Spot Run" type books I had as a child. And it wouldn't be hard (and could be an interesting meditation) to make further literary analogies as well: code like Hemingway written in short choppy functions or code like Austen written in florid, overly commented and meandering code. (No offense to Austen fans intended.)

Just as I learned to write in English at least in part by doing a lot of reading, I feel my Perl writing would improve by more exposure to other people's code, particularly, to well-written code. I'm looking for pointers to particularly well written modules (or open-source perl projects) that demonstrate good technique across a range of styles.

In scouring PM and other places, I've not found much that addresses this directly. I'm not looking for a list of "great" modules. Typical answers to this kind of question can be seen on Learning from modules -- which suggests looking at favorite or popular or otherwise "great" modules. I love lists of cool modules like the Advent calendar, too. But cool or heavily used or popular modules are not necessarily well-written or good to learn from -- even though they may be quite functional for day-to-day usage. They may have some quick and dirty hacks inside, may be poorly documented, may be full of "cargo-cult" holdovers, or may be so idiomatic as to be nigh-impenetrable.

Just as I wouldn't point someone to Barnes and Noble and say, "go browse around some bestsellers" to someone looking for a well written book, being told to go look at popular modules on CPAN isn't particularly helpful and is something I could have figured out myself.

Perl code in books about Perl isn't bad but isn't too great either, as it tends to be written simply for a wide audience or tends to be idealized to demonstrate particular techniques or situations. (An exception is probably "Effective Perl Programming" which I'd analogize to Strunk & White "Elements of Style" for improving one's craft).

All of which is to say that I'm looking for thoughtful suggestions for well-written real-world code that is available for review. This could include (but shouldn't be limited to):

  • Other people's code (modules/projects) that you've crawled around the inside of and think is well done
  • Good articles/presentations/books with fuller descriptions of working code
  • Things you've written yourself that you'd self-nominate for closer public scrutiny
  • More broadly, any CPAN authors that you feel generally demonstrate good style and technique

(To go one step further I'd also be interested in hearing the same about test-suites in modules. Now that I'm trying for a more TDD style, I'm pondering if I'm writing too many or too few tests in certain situations and good examples would be helpful.)

Thanks very much,

-xdg

Code posted by xdg on PerlMonks is public domain. It has no warranties, express or implied. Posted code may not have been tested. Use at your own risk.

Edits: Fixed spellings for Austen and Hemingway -- thanks Cody Pendant. My degree was clearly not in English Lit. :-)


In reply to Looking for examples of well-written modules by xdg

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others meditating upon the Monastery: (6)
As of 2024-03-28 13:15 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found