http://www.perlmonks.org?node_id=193664

mandog has asked for the wisdom of the Perl Monks concerning the following question:

We've written a simple script to do a simple task, still we'd like to include unit tests...

The problem is that if we don't run in test mode, we still get this message printed to stderr:

# No tests run!

Since the code will run from cron, this is a small hassle. The relivant bits are:

use Test::More qw(no_plan); if ( @ARGV == 0 ) { main(); } elsif ( @ARGV == 2 && lc( $ARGV[0] ) eq 'test' ) { Run_Test( $ARGV[1] ); } else { die "bad arguments: the comments may help in $0\n"; }


email: mandog