Re: Perl style examples (summary)



Patricia Shanahan wrote:
....
I'm looking for examples of code a skilled Perl programmer would be
delighted to see if asked to modify an existing program. I don't care
what it does, just how well it does it.

Also, are there books on Perl programming that focus on style and good
habits, and that are generally recommended?
....

Thanks to everyone who responded. It has been a very helpful discussion.
It seems to be winding down now, so here is a summary and my conclusions.

Suggested pieces of code:
========================

Code examples in Randal L Schartz columns at
http://www.stonehenge.com/merlyn/columns.html (John W. Krahn)

For CGI: http://users.easystreet.com/ovid/cgi_course/ (John W. Krahn)

John Krahn also mentions http://cpan.org, but that has both good and bad
style.

XML Xpath (Malcom Dew-Jones)

http://search.cpan.org/~stevan/ (Mark Thomas, good OO code, suggests
String::Tokenizer as something I can relate easily to other languages.)

Code posted by Jon Phipps.

Suggested books:
===============

"Perl Best Practices" by Damian Conway
http://www.oreilly.com/catalog/perlbp/(John W. Krahn, Sebastien Nadeau,
Janet Goldstein, Christian Winter, Adrian Howard. John Bokma has not
yet read it but plans to do so.)

Camel book 3rd edition (ISBN 0-596-00027-9) (Sebastien Nadeau - in
response to Jon Phipps, as a source for OO in Perl)

"Perl Cookbook" by Tom Christiansen and Nathan Torkington (Christian
Winter, for "examples of efficient and maintainable code)

"Perl Medic: Transforming Legacy Code" by Peter Scott (Adrian Howard)

"Programming Perl" (Ch. 24 - Common practices) (John Bokma)

perldoc perlstyle (John W. Krahn)

Conclusions:
===========

I've put "Perl Best Practices" by Damian Conway at the head of my
reading list. I'll select additional books after I've read that one.

I plan to look at the XML::Xpath and String::Tokenizer code. Although
the XML::Xpath code was criticized on grounds of how it handles
conditional return values, that turns out to be a debatable style issue.

Jon Phipps' coding style is better than a single blob of code, which is
how my first few attempts at Perl looked. However, the use of shared
global data seemed excessive to me, so I don't intend to emulate it.

Thanks again to everyone who posted.

Patricia

.



Relevant Pages

  • Re: Passing command line arguments
    ... On Friday 15 April 2005 12:18 am, John W. Krahn wrote: ... >> You could paste the two arguments together in perl, ... Prev by Date: ...
    (perl.beginners)
  • Re: How to deal with binary file?
    ... Tony Winslow wrote: ... John W. Krahn wrote: ... Perl is binary clean, so this shouldn't be a problem. ...
    (comp.unix.shell)
  • Re: How do I create this string?
    ... Flemming Greve Skovengaard wrote: ... John W. Krahn wrote: ... makes no sense so perl converts the value of the index to an integer so the ...
    (perl.beginners)
  • Re: Extracting Date using Regular Expressions
    ... John W. Krahn wrote: ... I need some help in regular expressions.... ... Perl isn't a toolbox, but a small machine shop where you can special-order ...
    (comp.lang.perl.misc)
  • Re: regular expression
    ... Thanks John. ... > I am looking for help on a PERL regular expression that can do the ... Make sure that the string is 20 chars or else match should fail. ... If you are not the intended recipient, ...
    (perl.beginners)