Net::S...::Rule(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::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 param ctrl.
  • 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 β€” 1 on success, 0 on 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 0 on 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 a Net::Sieve::Script::Action object.
  • Return β€” 1 on success.

πŸ’œ AUTHOR πŸ’œ

Yves Agostini
CPAN ID: YVESAGO
yvesago@cpan.org

we stan. 🫢


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