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>
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:
ImpGroups
CfgTie::TieGroup
(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:
CfgTie::TieAliases
#
Anything 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:
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.
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/)
To install Secure::File, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Secure::File
CPAN shell
perl -MCPAN -e shell install Secure::File
For more information on module installation, please visit the detailed CPAN module installation guide.