Home > programming > Perl Programming Best Practices LCA 2011

Perl Programming Best Practices LCA 2011

The first linx.conf.au videos are available online. From watching the talk Perl Programming Best Practices, here are some modules and suggestions mentioned in the talk as notes to myself:

  • Always add use strict and use warnings.
  • use autodie allows omitting the or die statements for catching errors.
  • given/when is analogous to switch/case in other languages.
  • say prints a line while automatically adding the newline.
  • Try::Tiny is a CPAN module for try/catch style exception handling.
  • carp and croak should be used to report errors in modules. It is more useful to see where wrong data was passed to the module function, than the exact place where the module called die.
  • App::perlbrew allows installing perl in the home directory.
  • local::lib helps installing perl modules in local directories.
  • Test::More is a module for running tests.
  • Devel::Cover can be used to measure the code coverage.
  • Perltidy reformats perl code to make it easier to read.
  • List::Util has some helper functions for lists (e.g. max, min, sum)
  • Named captures in regular expressions allow using named variables instead of $1, $2, … to extract parts of the original string.

This list is incomplete, and i would highly recommend watching the talk to see everything mentioned there.

Categories: programming Tags:
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s