This is the code from my "email parse script"
So that section is not relevant to your test script. If we omit it we can end up with a working version such as:
use strict;
use warnings;
use Test::More;
use Mail::DKIM::Verifier;
my @good = qw/good1.txt good2.txt/;
my @bad = qw/bad1.txt bad2.txt/;
plan tests => @good + @bad;
for my $goodfile (@good) {
my $dkim = Mail::DKIM::Verifier->new();
open (my $gfh, '<', $goodfile) or die "Error opening $goodfile: $!
+";
$dkim->load ($gfh);
is ($dkim->result_detail, 'pass', $goodfile);
close $gfh;
}
for my $badfile (@bad) {
my $dkim = Mail::DKIM::Verifier->new();
open (my $bfh, '<', $badfile) or die "Error opening $badfile: $!";
$dkim->load ($bfh);
isnt ($dkim->result, 'pass', $badfile);
close $bfh;
}
Obviously you can change the filenames in the @good and @bad arrays until you have what you want. This script works fine for me testing on good and bad data. |