Net::S...ndition(3pm)

πŸ“¦
version 0.09 Β· 2 versions
  • 0.09 Β· debian bookworm, debian trixie, ubuntu noble, ubuntu resolute, ubuntu stonking (latest)
  • 0.09 Β· ubuntu jammy
, in debian bookworm, debian trixie, ubuntu noble, ubuntu resolute, ubuntu stonking

πŸ’– Net::Sieve::Script::Condition πŸ’–

okay bestie, gather round, because this is the Net::Sieve::Script::Condition page from the User Contributed Perl Documentation, and it's literally the little gremlin that handles the condition part of your sieve scripts. it parses them, it writes them, it's giving parser-and-writer energy. πŸ¦‹


✨ NAME ✨

Net::Sieve::Script::Condition β€” parse and write conditions in sieve scripts. that's it, that's the whole job, and she does it flawlessly. πŸ’…


🌸 SYNOPSIS 🌸

here's the vibe, copy-paste ready:

use Net::Sieve::Script::Condition;

my $cond = Net::Sieve::Script::Condition->new('header');
  $cond->match_type(':contains');
  $cond->key_list('"[Test4]"');
  $cond->header_list('"Subject"');

 print $cond->write();

or, if you're feeling spicy and want to hand her a whole blob of text instead:

 my $cond = Net::Sieve::Script::Condition->new(
   'anyof (
     header :contains "Subject" "[Test]",
         header :contains "Subject" "[Test2]")'
       );

 print $cond->write();

both? valid. iconic? yes. πŸŽ€


πŸ‘‘ DESCRIPTION πŸ‘‘

she parses and writes the condition part of Sieve rules β€” go look at Net::Sieve::Script for the bigger picture, bestie, she's part of a whole ensemble. 🫢

she supports RFC 5228, 5231 (that's the relationnal one, spelling straight from the source, no notes) and the regex draft. no cap. πŸ”₯


🧚 CONSTRUCTOR 🧚

🌈 new 🌈

matches and sets accessors for each condition object in the conditions tree, and heads up: test is mandatory. you cannot skip it. she will not let you skip it. periodt. πŸ’€

Internal stuff (iykyk):

id :        id for condition, set by creation order
condition : array of sub conditions
parent :    parent of sub condition
AllConds :  array of pointers for all conditions

Condition parts (the actual lewks she can serve):

not          : 'not' or nothing
test         : 'header', 'address', 'exists', ...
key_list     : "subject" or ["To", "Cc"]
header_list  : "text" or ["text1", "text2"]
address_part : ':all ', ':localpart ', ...
match_type   : ':is ', ':contains ', ...
comparator   : string part

look at all those little parts. obsessed. ✨


πŸ’… METHODS πŸ’…

⭐ equals ⭐

Purpose  : test conditions
Return   : 1 on equals conditions

she checks if conditions match up. returns 1 when they're equals. simple, clean, slay. 🌸

πŸ¦‹ write πŸ¦‹

Purpose  : write rule conditions in text format
Return   : multi-line formatted text

she writes your rule conditions out as text and hands you back multi-line formatted text. chef's kiss. πŸ’–


πŸŽ€ AUTHOR πŸŽ€

Yves Agostini
CPAN ID: YVESAGO
yvesago@cpan.org

shoutout to Yves, the actual author, the main character. πŸ‘‘


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. go read it bestie, it's right there. πŸ“œ


and that's the whole page!! this was written against perl v5.34.0, dated 2022-06-30, and yes the manual name is Net::S...ndition(3pm) because the header truncated it like that and we respect the bit. bye babe, go parse some conditions πŸ’œβœ¨πŸ¦‹
πŸ“¦ where this page comes from