Procmail recipe file interface software.
With Mail::Procmailrc, you can even create a new, empty object and add new recipes and/or variables to it before writing it out to a file. Recipes and variables are written to the file in the order they're parsed and added. However, if you want to re-order the recipes, you may do so by getting a handle on the variable or recipe list and ordering them yourself.
The Mail::Procmailrc object is essentially a list of procmail component objects, which preserves the order in which it encounters these procmail components and stores them as a list of objects in the main Mail::Procmailrc object. When the module parses a procmail rc file, it decides which lines are variable assignments, comments, and recipes to maintain the order.
To use Mail::Procmailrc, you'll need to install it and write code that calls the module's functions. The sample code below shows how you might use the module to parse a procmail rc file found at "$HOME/.procmail/rc.spam":
```
use Mail::Procmailrc;
## create a new procmailrc object and initialize it
$pmrc = new Mail::Procmailrc("$HOME/.procmail/rc.spam");
## add a new variable
$pmrc->push( new Mail::Procmailrc::Variable(["FOO=bar"]) );
## add a new recipe
$recipe =rc} ) {
## find the recipe we just added by its 'info' string
next unless $obj->stringify =~ /^## this will catch evil email messages/m;
## we want to block emails about censorship, too ;o)
push @{$obj->conditions}, '* 1^0 censor(ship|ing)?'
}
## write this object to disk
$pmrc->flush;
```
Overall, Mail::Procmailrc is an excellent Perl module that can be a valuable addition to any procmail developer's toolbox.
Version 1.09: N/A