Algorithm-ToNumberMunger
view release on metacpan or search on metacpan
lib/Algorithm/ToNumberMunger.pm view on Meta::CPAN
spellings C<error> (for C<temperror>) and C<unknown> (for C<permerror>) are
accepted as aliases. Numeric inputs are not passed through.
=head2 dmarc_result_enum
{ munger => 'dmarc_result_enum', default => -1 }
Named-map enum (lookup rules as L</dns_rcode_enum>) for a DMARC evaluation
result (RFC 7489 / RFC 8601), as logged by opendmarc or carried in an
C<Authentication-Results> header: C<pass> 0, C<none> 1, C<fail> 2, C<temperror>
3, C<permerror> 4, and opendmarc's C<bestguesspass> 5. This is the DMARC
I<result> (did the message pass alignment), not the policy I<disposition>
(C<none>/C<quarantine>/C<reject>) -- for that, use a plain L</enum>. Numeric
inputs are not passed through.
=head2 sasl_mech_enum
{ munger => 'sasl_mech_enum', default => -1 }
Named-map enum (lookup rules as L</dns_rcode_enum>) for the SASL
authentication mechanism -- as Dovecot logs C<mech=>, Postfix logs
lib/Algorithm/ToNumberMunger.pm view on Meta::CPAN
},
},
dmarc_result => {
numeric => 0,
map => {
pass => 0,
none => 1,
fail => 2,
temperror => 3,
permerror => 4,
bestguesspass => 5,
},
},
sasl_mech => {
numeric => 0,
map => {
do {
my @o = @SASL_MECHS_BY_STRENGTH;
map { $o[$_] => $_ } 0 .. $#o;
},
},
t/mungers.t view on Meta::CPAN
is( $spf->('unknown'), $spf->('permerror'), 'spf unknown aliases permerror' );
my $dkim = $M->build( { munger => 'dkim_result_enum' } );
is( $dkim->('pass'), 0, 'dkim pass' );
is( $dkim->('policy'), 3, 'dkim policy' );
is( $dkim->('fail'), 4, 'dkim fail' );
my $dmarc = $M->build( { munger => 'dmarc_result_enum', default => -1 } );
is( $dmarc->('pass'), 0, 'dmarc pass' );
is( $dmarc->('fail'), 2, 'dmarc fail' );
is( $dmarc->('bestguesspass'), 5, 'dmarc opendmarc bestguesspass' );
is( $dmarc->('quarantine'), -1, 'dmarc result != disposition (quarantine unlisted)' );
eval { $M->build( { munger => 'spf_result_enum' } )->(4) };
like( $@, qr/no mapping for '4'/, 'mail result enums do not pass a number through' );
}
# ---- Apache / Dovecot named enums -------------------------------------------
{
# The full mechanism set the two SASL mungers share.
my @mechs = qw(
( run in 0.928 second using v1.01-cache-2.11-cpan-7fcb06a456a )