NAME

Sieve::Generator - generate Sieve email filter scripts

VERSION

version 0.001

SYNOPSIS

use Sieve::Generator::Sugar '-all';

my $script = sieve(
  command('require', qstr([ qw(fileinto imap4flags) ])),
  blank(),
  ifelse(
    header_exists('X-Spam'),
    block(
      command('addflag', qstr('$Junk')),
      command('fileinto', qstr('Spam')),
    ),
  ),
);

print $script->as_sieve;

DESCRIPTION

Sieve::Generator is a library for generating Sieve (RFC 5228) email filter programs. With it, you build a tree of objects that can be rendered as a complete, correctly-indented Sieve script. These trees can be snipped apart and stitched together, so you can generate subtrees and combined them into the behavior you want.

The primary interface is Sieve::Generator::Sugar, which exports short constructor functions (sieve, ifelse, block, command, qstr, and so on) for building the object tree without referring to the underlying class names directly.

The object tree will be made up of objects that expose an as_sieve method, which renders the object (and all its descendants) as Sieve. Some of the classes are meant to be suitable for direct use, and others are implementation details that might change later.

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.

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.