NAME
Sieve::Generator::Element - role for objects that render as Sieve code
VERSION
version 0.003
DESCRIPTION
This role is consumed by all objects that can render themselves as Sieve code. It requires a single method, as_sieve.
PERL VERSION
This module is shipped with no promise about what version of perl it will require in the future. In practice, this tends to mean "you need a perl from the last three years," but you can't rely on that. If a new version of perl ship, this software may begin to require it for any reason, and there is no promise that patches will be accepted to lower the minimum required perl.
METHODS
as_sieve
my $sieve_text = $element->as_sieve;
my $sieve_text = $element->as_sieve($indent_level);
This method renders the object as a string of Sieve code. The optional $indent_level argument is a non-negative integer controlling the indentation depth; each level adds two spaces. If not given, no indenting is added.
children
my @children = $element->children;
Returns all child Elements of this node. Leaf nodes return an empty list. Container nodes return their direct children. This is used by find_elements to walk the tree.
find_elements
my @found = $element->find_elements(\&predicate);
Walks the element tree depth-first, returning all elements (including $element itself) for which the predicate returns true. Descends into matching nodes, so all matches at any depth are returned.
AUTHOR
Ricardo Signes <rjbs@semiotic.systems>
COPYRIGHT AND LICENSE
This software is copyright (c) 2026 by Ricardo SIGNES.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.