You are looking at a very old, but free version of the course. If you are interesed the most recent version, check it out on the Perl Maven site.

6.14. Create a test module

You need the above my_test subroutine in several of your test files. So you create a module for this.

use Test::More tests => 2;
use Test::MyTest "my_test";
my_test(2, '+', 3, 5);
my_test(4, '+', 4, 10);
package Test::MyTest;
require Exporter;
our @ISA = qw(Exporter);
our @EXPORT_OK = qw(my_test);

sub my_test {
   my ($x, $op, $z, $expected) = @_;

   # do stuff

   is($result, $expected);
}

Not good !

We need the is function from the Test::More package. so we'll have to use it in our module as well but Test::More needs a "plan".


If you are interested in on-site trainings by the author, please contact me directly.