use Test::More; use File::Find; use DBI; my $dbh = DBI->connect( ... ); my ($file_count) = $dbh->selectrow_array( 'SELECT count(*) FROM t' ); plan 'tests' => $tests_per_file * $file_count; find({ wanted => \&verify, follow_fast => 1 }, $storage_dir ); diag( "It's normal to run more tests than planned because files have been created since the records were counted" );