| CfgTie documentation | view source | Contained in the CfgTie distribution. |
CfgTie::TieAliases -- an associative array of mail aliases to targets
Makes it easy to manage the mail aliases (/etc/aliases) table as a hash.
tie %mtie,'CfgTie::TieAliases'
#Redirect mail for foo-man to root
$mtie{'foo-man'}=['root'];
This Perl module ties to the /etc/aliases file so that things can be updated on the fly. When you tie the hash, you are allowed an optional parameter to specify what file to tie it to.
tie %mtie,'CfgTie::TieAliases'
or
tie %mtie,'CfgTie::TieAliases',I<aliases-like-file>
or
tie %mtie,'CfgTie::TieAliases',I<revision-control-object>
ImpGroups will import the various groups from /etc/group using
CfgTie::TieGroup. It allows an optional code reference to select which
groups get imported. This code is passed a reference to each group and needs
to return nonzero if it is to be imported, or zero if it not to be imported.
For example:
(tied %mtie)->ImpGroups
{
my $T=shift;
if ($T->{'id} < 100) {return 0;}
return 1;
}
The format of the /etc/aliases file is poorly documented. The format that
CfgTie::TieAliases understands is documented as follows:
#commentsAnything after a hash mark (#) to the end of the line is treated as a
comment, and ignored.
:The letters, digits, dashes, and underscores before a colon are treated as the name of an alias. The alias will be expanded to whatever is on the line after the colon. (Each of those is in turn expanded).
:include:fileAny element of the alias list that includes :include: indicates that the
specified file should be read from. The file may only specify user names or
email addresses. Several include directives may used in the aliase. It is not
clear which of these files is the preferred file to modify.
Any line that starts with a space is a continuation of the previous line.
Not all changes to are immediately reflected to the specified file. See the CfgTie::Cfgfile module for more information
/etc/aliases
CfgTie::Cfgfile, CfgTie::TieRCService, CfgTie::TieGeneric, CfgTie::TieGroup, CfgTie::TieHost, CfgTie::TieNamed, CfgTie::TieNet, CfgTie::TiePh, CfgTie::TieProto, CfgTie::TieServ, CfgTie::TieShadow, CfgTie::TieUser
aliases(5) newaliases(1)
Randall Maas (randym@acm.org, http://www.hamline.edu/~rcmaas/)
| CfgTie documentation | view source | Contained in the CfgTie distribution. |