[tpm] testing; using eval to catch an error in a module

Michael Graham magog at the-wire.com
Sat Aug 29 12:14:50 PDT 2009

> I'm pretty sure I'm not doing it the "proper" way, but my Googling 
> hasn't yielded much yet. The most I've been able to gather so far is 
> that the "normal" way is to have a 't' directory and in there have a 
> 'test.pl' that 'make install' can call.

Well, it is true that "make test" will indeed run your module's test
suite.  But honestly, that's not the main reason to do things The
Right Way (tm) instead of the Hacky Handmade Way (tm).

The advantages to doing standard Perl testing are:

  * your tests will be easier to write
  * your tests will be more concise

  * your tests will be more maintainable

  * your tests will make sense to other people

  * you can do more sophisticated testing more quickly (e.g. with
    Test::Deep, Test::MockObject, etc.)

  * you can get Test coverage with Devel::Cover

  * you can make a web-based dashboard of your test results by
    running your tests automatically on an hourly schedule and
    importing them into Smolder.  
    Imagine setting off alarm bells right after you break
    your code, instead of discovering the problem three weeks later
    when you finally decide to run your test suite again!

To get started, check out the following docs:





More information about the toronto-pm mailing list