Net::S...::Rule(3pm)
π Net::Sieve::Script::Rule β the perl module page β¨
okay bestie, so this is the manual for Net::Sieve::Script::Rule, a lil Perl module that lives in the User Contributed Perl Documentation section. it parses and writes rules in sieve scripts β that's the whole job, and it does it slayfully. π
πΈ NAME πΈ
Net::Sieve::Script::Rule β parse and write rules in sieve scripts π¦
β¨ SYNOPSIS β¨
here's the vibe, copy-paste ready:
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;
likeβ¦ build a rule, stack a condition on it, stack an action on it, print it out. main character pipeline fr fr. π
π DESCRIPTION π
so bestieβ¦ the original page just has the heading and then nothing. the section header is there, the actual description is not. iconic of it honestly. π i'm not gonna make stuff up and pretend it's canon, so: the DESCRIPTION is empty on this page, periodt. everything juicy lives in CONSTRUCTOR and METHODS. π«Ά
π§ CONSTRUCTOR π§
π new
the moment you've been waiting for. args time:
Arguments :
order => : optional set priority for rule
ctrl => : optional default 'if', else could be 'else', 'elsif'
or 'vacation'
test_list => : optional conditions by string or by Condition Object
block => : optional block of commands
Returns : Net::Sieve::Script::Rule object
quick translation bestie:
orderβ optional, sets the priority for the rule.ctrlβ optional, defaults to'if', but it could also be'else','elsif'or'vacation'.test_listβ optional, conditions given either as a string or as a Condition Object.blockβ optional, a block of commands.
and it hands you back a Net::Sieve::Script::Rule object. so generous of it. π
Set accessors
the little setters/getters that run this whole operation:
alternateβ same as the paramctrl.conditionsβ the first condition in the tree.actionsβ an array of actions objects.priorityβ the rule's order in the script, aka the main id for the rule.requireβ (yes, it's listed here, that's the accessor name, that's all it says).
π METHODS π
πΈ equals
returns 1 if the rules are equal. that's it. short king behaviour. β¨
π¦ write
returns the rule in text format. this is the one you print, bestie. π₯
π write_condition
sets require for the conditions that got used, then returns the conditions in text format. π«Ά
β write_action
sets require for the actions that got used, then returns the actions in text format. π
π delete_condition
- Purpose β delete a condition by rule; delete all block on delete anyof/allof; delete a single anyof/allof block, where a single condition moves up.
- Arguments β condition id.
- Returns β
1on success,0on error.
π add_condition
- Purpose β add a condition to the rule; adds an
'allof'group on the second rule. - Arguments β a string or a Condition object.
- Returns β the new condition id, or
0on error.
π₯ swap_actions
swaps actions by order. returns 1 on succes, 0 on failure. (yes, "succes" β that's the original spelling, and i am not touching it, no cap. π)
π find_action
find an action by order.
Returns: a Net::Sieve::Script::Action object, or 0 on error.
π delete_action
deletes an action by order β and heads up, first is 1. not zero. one. okurrr. π
π§ add_action
- Purpose β add an action at the end of the block.
- Arguments β a command line, or a command line list with
;separator, or aNet::Sieve::Script::Actionobject. - Return β
1on success.
π AUTHOR π
Yves Agostini
CPAN ID: YVESAGO
yvesago@cpan.org
we stan. π«Ά
π 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.
and that's the whole page bestie, ty for coming to my ted talk π this was Net::Sieve::Script::Rule(3pm) from the User Contributed Perl Documentation, footer said perl v5.34.0 dated 2022-06-30, so mwah, go write some sieve rules, you absolute icon πβ¨π¦
π¦ where this page comes from
- debian bookworm: libnet-sieve-script-perl 0.09-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- debian trixie: libnet-sieve-script-perl 0.09-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: libnet-sieve-script-perl 0.09-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libnet-sieve-script-perl 0.09-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libnet-sieve-script-perl 0.09-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms