You also might want to take a look at
Test::Cmd,
which I created to try to factor out some
underlying testing building blocks
common to a number of utilities for which I
was writing test suites.
The intention is for you to subclass
Test::Cmd to build up
testing infrastructure that's particular to
your command or system under test.
In addition to providing some potentially useful
testing infrastructure in its own right,
it uses the standard
Test
module for its own internal tests,
which might serve as a useful example.