NAME

Mail::Colander - Categorize and manage email messages

VERSION

This document describes Mail::Colander version 0.004.

Build Status Perl Version Current CPAN version Kwalitee CPAN Testers CPAN Testers Matrix

SYNOPSIS

use Mail::Colander;

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

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

DESCRIPTION

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

INTERFACE

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 Data::Annotation object either passed directly, or passed through a definition hash reference that can then be turned into a Data::Annotation object.

Accessors

annotator

my $data_annotation_instance = $ms->annotator;

Get the underlying Data::Annotation object.

Methods

description

my $text = $ms->description;

Same as $ms->annotator->description.

has_chain_for

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

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

policy_for

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

Determine the annotations for $element, starting at $chain. See 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 accept or reject and then the server would act accordingly.

BUGS AND LIMITATIONS

Minimul perl version 5.24.

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

AUTHOR

Flavio Poletti <flavio@polettix.it>

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