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

I have a script which is something similar as below. I want to use Test::More to do some unit testing on the script.
But from what I know, Test::More is only applicable to modules. So, aside from converting my script into a module, is there a way to do a unit testing on a script?
#!/usr/bin/perl use Getopt::Std; getopts('xp', \%opt); $arg_1 = $opt{'x'} if (defined($opt{'x'})); $arg_2 = $opt{'p'} if (defined($opt{'p'})); sub test_a { print "argument is from $arg_1\n"; } sub test_b { print "argument is from $arg_2\n"; }

Replies are listed 'Best First'.
Re: How to do Unit Testing on a Script
by GrandFather (Saint) on Oct 02, 2008 at 03:22 UTC
      Thanks. Need to learn how to use super search.
Re: How to do Unit Testing on a Script
by andreas1234567 (Vicar) on Oct 02, 2008 at 07:36 UTC
Re: How to do Unit Testing on a Script
by repellent (Priest) on Oct 02, 2008 at 18:57 UTC