=pod

=for vim
   vim: tw=72 ts=3 sts=3 sw=3 et ai :

=encoding utf8

=head1 NAME

Mail::Colander - Categorize and manage email messages


=head1 VERSION

This document describes Mail::Colander version 0.004.

=begin html

<a href="https://travis-ci.org/polettix/Mail-Colander">
<img alt="Build Status" src="https://travis-ci.org/polettix/Mail-Colander.svg?branch=master">
</a>
<a href="https://www.perl.org/">
<img alt="Perl Version" src="https://img.shields.io/badge/perl-5.24+-brightgreen.svg">
</a>
<a href="https://badge.fury.io/pl/Mail-Colander">
<img alt="Current CPAN version" src="https://badge.fury.io/pl/Mail-Colander.svg">
</a>
<a href="http://cpants.cpanauthors.org/dist/Mail-Colander">
<img alt="Kwalitee" src="http://cpants.cpanauthors.org/dist/Mail-Colander.png">
</a>
<a href="http://www.cpantesters.org/distro/O/Mail-Colander.html?distmat=1">
<img alt="CPAN Testers" src="https://img.shields.io/badge/cpan-testers-blue.svg">
</a>
<a href="http://matrix.cpantesters.org/?dist=Mail-Colander">
<img alt="CPAN Testers Matrix" src="https://img.shields.io/badge/matrix-@testers-blue.svg">
</a>

=end html

=head1 SYNOPSIS

   use Mail::Colander;

   my $sieve = Mail::Colander->new(annotator => \%data_annotation_def);

   # 
   my $policy = $sieve->policy_for(foo => $element);
   if ($policy eq 'delete') { ... }


=head1 DESCRIPTION

This is a wrapper around L<Data::Annotation> thought for dealing with
email messages. This very class only contains an L<annotator> member,
which is supposed to be a L<Data::Annotation> instance, and wraps the
call to L</Data::Annotation::evaluate> inside a more expressive
L</policy_for> method.

=head1 INTERFACE

=head2 Constructor

   my $ms = Mail::Colander->new(annotator => \%definition);   # OR

   my $da = Data::Annotation->new(%definition);
   my $ms = Mail::Colander->new(annotator => $da);

Get a new instance, with the underlying L<Data::Annotation> object
either passed directly, or passed through a definition hash reference
that can then be turned into a L<Data::Annotation> object.

=head2 Accessors

=head3 B<< annotator >>

   my $data_annotation_instance = $ms->annotator;

Get the underlying L<Data::Annotation> object.

=head2 Methods

=head3 B<< description >>

   my $text = $ms->description;

Same as C<< $ms->annotator->description >>.

=head3 B<< has_chain_for >>

   my $text = $ms->has_chain_for($chain_name);

Same as C<< $ms->annotator->has_chain_for($chain_name) >>.

=head3 B<< policy_for >>

   my $policy = $ms->policy_for($chain, $element);

Determine the annotations for C<$element>, starting at C<$chain>. See
L<Data::Annotation> for the details.

Depending on the definition, a policy will then tell what to do next,
e.g. in a SMTP server context the policies might be returned as
C<accept> or C<reject> and then the server would act accordingly.


=head1 BUGS AND LIMITATIONS

Minimul perl version 5.24.

Report bugs through GitHub (patches welcome) at
L<https://github.com/polettix/Mail-Colander>.

=head1 AUTHOR

Flavio Poletti <flavio@polettix.it>

=head1 COPYRIGHT AND LICENSE

Copyright 2024 by Flavio Poletti <flavio@polettix.it>

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

Just to be clear: apache-2.0


=cut
