Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Locked thread
repeater
Dec 21, 2001

"Choo-Choo"
The Hurkey Jerkey Dancer
^^ Agreed

"Perl Best Practices" by Damian Conway is hands-down the best perl book I have ever read, and (even though it is all perl) has a ton of general "do it right like this and here is why and why not" kind of advice for those of us that jump around languages a lot.

It is formatted very similar to the Cookbook, but the answers are more focused on maintainability and clean coding practices rather than "look what I can do!" - which is what really bugs me about the cookbook.

It really made me appreciate the language more, even as a really ocd-ish coder living in a perl shop.

Perl Design Patterns is also a great resource, especially the Problem Index. Most of the common big-picture / refactoring problems found in perl applications are targeted there with suggestions for a clean design fix.

Also, everyone should use Inside-Out Objects and be happy.

Adbot
ADBOT LOVES YOU

repeater
Dec 21, 2001

"Choo-Choo"
The Hurkey Jerkey Dancer

ashgromnies posted:

I'm just unsure if perl6 will be released in time to be useful - they've been developing it since, what, 2000? So many other dynamic languages have been picking up speed and getting massive developer support - perl6 looks very cool, but I don't know how well it will fare since it seems like new projects written in perl are becoming less common and it's being used more to maintain legacy code.
The main core of people working on Perl6 seem to be doing some really kickass stuff, but unfortunately I will still be ignoring it until it get close enough to release (all the stuff I do needs stable, not bleeding edge). Also, I am pretty agnostic to the language I work in, so I am not sitting around tapping my foot waiting for "the new perl". Perl 5.x is getting the job done, so that is what I use.

The best part of the whole Perl6 thing is the backporting of some of the cool and handy stuff from 6 for use in 5.x:

See: Perl6::* on CPAN

(Notice most of the cool ones are by Damien Conway, because he is awesome as all hell)

While I am at it and kissing Conway's rear end, I also really reccomend the Getopt::Euclid module, which lets you write a perldoc explaining your script usage while ALSO using that same perldoc to know how to grab command opts and type checking them without extra work from you.

For example,
code:
  =item  --foo <bar>
  
  Specify a bar number for a foo (must be a positive number, defaults to 1234)

  =for Euclid:
    bar.type:    +int
    bar.default: 1234

Next time you run your script:

* The help / usage / man flags will show the new command line option (duh)
* User can specify --foo 2132142 without extra work from you
* Your code can grab it as $ARGV{foo} (much prettier than the normal way of doing it via getopts or straight @ARGV)
* Default is set somewhere sane
* Input / type checking is done before it even GETS to your code, including proper error messages (you do NOT ever have to write type checking error messages for your input params again)

So yea, not amazingly cool, but it is little stuff like that for perl that makes me love it. Someone just went "wait, this is the best way to express this common task just once and just make it work, so you can move on to the actual bizlogic code you get paid to write" - and I can get behind that kind of thinking.

repeater fucked around with this message at 22:48 on Oct 26, 2007

  • Locked thread