msimerson / mail-dmarc

Mail::DMARC, a complete DMARC implementation in Perl
Other
33 stars 23 forks source link

parameters for "one-shot" passing to new do not match method arguments #19

Closed rjbs closed 9 years ago

rjbs commented 9 years ago

I tried to get a Mail::DMARC::PurePerl via new, but hit a couple snags.

  1. You can't pass a Mail::DKIM::Verifier as the dkim argument in new, only via the dkim setter. If you do, you get "dkim needs to be an array reference!"
  2. You can't pass a hashref as the spf argument in new, because it wants an arrayref. If you pass the documented pairs as an arrayref, you get "Can't use string ("domain") as a HASH ref while "strict refs"". Maybe it wants an arrayref of hashrefs, but I gave up at that point.

The new method and the individual setters, for these two at least, have very different behaviors. Please either make them the same, or document each.

Thanks!

msimerson commented 9 years ago

Please test that 8b58411 solves #1 for you.

I updated the docs to reflect that new(spf=>this) takes an arrayref of hashrefs (generally a scope=mfrom and scope=helo). It's a lot more punctuation than $dmarc=>spf( %hash ) but works equally for both invocation methods.

I've also stubbed in some tests that do everything but supply a Mail::DKIM::Verifier object. I couldn't quickly figure out how to mock up a perl coderef that works for $dkim->signatures or I'd have done so myself.

msimerson commented 9 years ago

Now the tests do stub in a Mail::DKIM::Verifier object and pass it in.