NAME
Net::Sieve::Script::Rule - parse and write rules in sieve scripts
SYNOPSIS
use Net::Sieve::Script::Rule;my $pRule = Net::Sieve::Script::Rule->new (ctrl => $ctrl,test_list => $test_list,block => $block,order => $order);
or
my $rule = Net::Sieve::Script::Rule->new();
my $cond = Net::Sieve::Script::Condition->new('header');
$cond->match_type(':contains');
$cond->header_list('"Subject"');
$cond->key_list('"Re: Test2"');
my $actions = 'fileinto "INBOX.test"; stop;';
$rule->add_condition($cond);$rule->add_action($actions);print $rule->write;
DESCRIPTION
CONSTRUCTOR
new
Arguments :order => : optional set priority for rulectrl => : optional default 'if', else could be 'else', 'elsif'or 'vacation'test_list => : optional conditions by string or by Condition Objectblock => : optional block of commandsReturns : Net::Sieve::Script::Rule object
Set accessors
alternate : as param ctrlconditions : first condition in treeactions : array of actions objectspriority : rule order in script, main id for rulerequire :
METHODS
equals
return 1 if rules are equals
write
Return rule in text format
write_condition
set require for used conditionsreturn conditions in text format
write_action
set require for used actionsreturn actions in text format
delete_condition
Purpose : delete condition by rule, delete all block on delete anyof/allofdelete single anyof/allof block : single condition move upArguments : condition idReturns : 1 on success, 0 on error
add_condition
Purpose : add condition to rule, add 'allof' group on second ruleArguments : string or Condition objectReturns : new condition id or 0 on error
swap_actions
swap actions by orderreturn 1 on succes, 0 on failure
find_action
find action by orderReturns: Net::Sieve::Script::Action object, 0 on error
delete_action
delete action by order, first is 1;
add_action
Purpose : add action at end of blockArguments : command lineor command line list with ; separatoror Net::Sieve::Script::Action objectReturn : 1 on success
AUTHOR
Yves AgostiniCPAN ID: YVESAGO[email protected]
COPYRIGHT
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
The full text of the license can be found in the LICENSE file included with this module.