CfgTie::TieAliases -- an associative array of mail aliases to targets


NAME

CfgTie::TieAliases -- an associative array of mail aliases to targets


SYNOPSIS

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'];


DESCRIPTION

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>

Methods

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;
        }

Format of the /etc/aliases file

The format of the /etc/aliases file is poorly documented. The format that CfgTie::TieAliases understands is documented as follows:

#comments
Anything after a hash mark (#) to the end of the line is treated as a comment, and ignored.

text:
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:file
Any 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.

Continuation lines
Any line that starts with a space is a continuation of the previous line.


Caveats

Not all changes to are immediately reflected to the specified file. See the the CfgTie::Cfgfile manpage module for more information


FILES

/etc/aliases


See Also

the CfgTie::Cfgfile manpage, the CfgTie::TieRCService manpage, the CfgTie::TieGeneric manpage, the CfgTie::TieGroup manpage, the CfgTie::TieHost manpage, the CfgTie::TieNamed manpage, the CfgTie::TieNet manpage, the CfgTie::TiePh manpage, the CfgTie::TieProto manpage, the CfgTie::TieServ manpage, the CfgTie::TieShadow manpage, the CfgTie::TieUser manpage

aliases(5) newaliases(1)


Author

Randall Maas (randym@acm.org, http://www.hamline.edu/~rcmaas/)

 CfgTie::TieAliases -- an associative array of mail aliases to targets