use strict; use warnings; use Test::More qw(no_plan); #imports testing tools use MyModule; #that's your code my $mech = WWW::Mechanize->new( autocheck => 1 ); #call repeatedly with various values of $start, $regex # is_deeply compares data structures element by element # is_deeply($got, $expected, $description_of_test) my $start = "http://www.domain.com"; my $regex = qr/\d+.+\.pdf$/; my $aExpected = [ 'foo.pdf', 'baz.pdf' ]; is_deeply(getAllLinks($mech, $start, $regex), $aExpected , "getAllLinks: start=$start, regex=$regex"); #call repeatedly with various urls # is compares simple scalars # is($got, $expected, $description_of_test) is(getByteCount($mech, $url), $iExpected , "getByteCount: url=$url");