Algorithm-ToNumberMunger
view release on metacpan or search on metacpan
refrain entirely from distribution of the Library.
If any portion of this section is held invalid or unenforceable under any
particular circumstance, the balance of the section is intended to apply,
and the section as a whole is intended to apply in other circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
12. If the distribution and/or use of the Library is restricted in
RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Libraries
If you develop a new library, and you want it to be of the greatest
possible use to the public, we recommend making it free software that
everyone can redistribute and change. You can do so by permitting
redistribution under these terms (or, alternatively, under the terms of the
ordinary General Public License).
To apply these terms, attach the following notices to the library. It is
safest to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least the
"copyright" line and a pointer to where the full notice is found.
<one line to give the library's name and a brief idea of what it does.>
lib/Algorithm/ToNumberMunger.pm view on Meta::CPAN
emits (C<no action>/C<no_action>, C<add header>/C<add_header>, ...) are
accepted. Numeric inputs are not passed through.
=head2 ssh_auth_method_enum
{ munger => 'ssh_auth_method_enum', default => -1 }
Named-map enum (lookup rules as L</dns_rcode_enum>) for the OpenSSH
authentication method logged by C<sshd> (the word after C<Accepted>/C<Failed>,
or the C<method=> field): C<none> 0, C<password> 1, C<keyboard-interactive> 2,
C<hostbased> 3, C<publickey> 4, C<gssapi-with-mic> 5, C<gssapi-keyex> 6, with
bare C<gssapi> aliased to C<gssapi-with-mic>. Numbered roughly
B<weakest-to-strongest> so "weaker credential than expected" is a monotone
feature; the ordering is a judgement call, not a registry. Numeric inputs are
not passed through.
=head2 amavis_category_enum
{ munger => 'amavis_category_enum', default => -1 }
Named-map enum (lookup rules as L</dns_rcode_enum>) for the amavisd-new
lib/Algorithm/ToNumberMunger.pm view on Meta::CPAN
},
ssh_auth_method => {
numeric => 0,
map => {
# OpenSSH authentication method, ordered by credential strength
# (weakest first) so "weaker than expected" is monotone. The
# ordering is a judgement call, not an IANA registry.
do {
my @o = qw(
none password keyboard-interactive
hostbased publickey
gssapi-with-mic gssapi-keyex
);
my %m = map { $o[$_] => $_ } 0 .. $#o;
$m{'gssapi'} = $m{'gssapi-with-mic'};
%m;
},
},
},
amavis_category => {
numeric => 0,
t/mungers-datetime-fast.t view on Meta::CPAN
is( $c->('2026-07-05T14:00:00'), 14, 'different stamp is not served stale' );
is( $c->('2026-07-05T13:00:00'), 13, 'switching back re-parses correctly' );
# a parse failure must not poison the memo
eval { $c->('garbage') };
like( $@, qr/cannot parse 'garbage'/, 'bad input croaks on the fast path' );
is( $c->('2026-07-05T14:00:00'), 14, 'memo survives a failed parse' );
# multi-output memo: same pair, then a different stamp
my ( $code, $arity ) = do {
# via compile, the public route to a multi munger
my $plan = $M->compile(
tags => [qw(s c)],
mungers => {
tw => {
munger => 'datetime',
from => 'ts',
format => $FMT,
parts => [qw(sin_week cos_week)],
into => [qw(s c)]
}
t/mungers.t view on Meta::CPAN
is( $ra->('add_header'), 2, 'rspamd add_header underscore alias' );
is( $ra->('rewrite subject'), 3, 'rspamd rewrite subject' );
is( $ra->('soft reject'), 4, 'rspamd soft reject' );
is( $ra->('reject'), 5, 'rspamd reject' );
ok( $ra->('greylist') < $ra->('reject'), 'rspamd_action ordered by severity' );
my $sm = $M->build( { munger => 'ssh_auth_method_enum', default => -1 } );
is( $sm->('none'), 0, 'ssh none' );
is( $sm->('password'), 1, 'ssh password' );
is( $sm->('keyboard-interactive'), 2, 'ssh keyboard-interactive' );
is( $sm->('publickey'), 4, 'ssh publickey' );
is( $sm->('gssapi'), $sm->('gssapi-with-mic'), 'ssh gssapi aliases gssapi-with-mic' );
ok( $sm->('password') < $sm->('publickey'), 'ssh_auth_method weakest-to-strongest' );
is( $sm->('magic'), -1, 'ssh_auth_method default for unlisted' );
my $am = $M->build( { munger => 'amavis_category_enum', default => -1 } );
is( $am->('clean'), 0, 'amavis clean' );
is( $am->('spam'), 4, 'amavis spam' );
is( $am->('bad-header'), $am->('badheader'), 'amavis bad-header aliases badheader' );
is( $am->('virus'), $am->('infected'), 'amavis virus aliases infected' );
ok( $am->('clean') < $am->('infected'), 'amavis_category ordered clean-to-worst' );
my $sr = $M->build( { munger => 'systemd_result_enum', default => -1 } );
( run in 0.565 second using v1.01-cache-2.11-cpan-bbcb1afb8fc )