[Wellington-pm] Roundup of last night's meeting

Grant McLean grant at mclean.net.nz
Tue Aug 12 20:50:59 PDT 2008

Hi Mongers

I've put the slides from last night's talks up on the web site:


Thank you to our speakers and also to the lively audience.

You've now all had plenty of time to consider the question of what you'd
like to talk about next month so please reply here to book your slot.

Further to last night's discussion on the subject of dealing with legacy
code, perhaps people could reply here with a few points that may have
been mentioned last night but also may have been forgotten.  My 2
cents ...

Where possible write code as subroutines in modules (.pm files).  This
means that the scripts you run end up being very short wrappers that
'use' the required modules and call the subroutines.

Putting code in modules tends to make it more modular and hopefully
easier to reuse.  However the key motivation is that it makes it easier
to write tests.  Building up a good set of tests gives you the
confidence to change things that need to be changed without worrying
that you might break something.

Building up a test suite for a large existing code base can be a
daunting task.  My advice is start small and build up over time.  Write
tests for routines in an existing module.  Add more tests as you find
the time.  Any time you change or add code, make sure that you write
tests as part of the change.  Once you have some tests, use Devel::Cover
to get a colour-coded report showing line-by-line which parts of your
code are exercised by tests and which are not.  You can turn it into a
game where you set a goal like "I'm going to increase our code coverage
by 5% today".  Once your coverage is up around 90% you'll see
diminishing returns for writing further tests.

If you don't recall how to write tests, there is a tutorial in the
Test::Simple distribution:


You will probably want to use at least the Test::More module and the
'prove' command-line utility that is included in the Test::Harness
distribution and recent versions of Perl.

If you have trouble getting started, just ask here and we'll get you on


More information about the Wellington-pm mailing list