Provided by: libunix-configfile-perl_0.6-1_all
NAME
Unix::AliasFile - Perl interface to /etc/aliases format files
SYNOPSIS
use Unix::AliasFile; $al = new Unix::AliasFile "/etc/aliases"; $al->alias("bozos", @members); $al->delete("deadlist"); $al->remove_user("coolmail", "bgates", "badguy"); $al->add_user("coolmail", "joecool", "goodguy"); $al->remove_user("*", "deadguy"); $al->commit(); undef $al;
DESCRIPTION
The Unix::AliasFile module provides an abstract interface to Unix alias files. It automatically handles file locking, getting colons and commas in the right places, and all the other niggling details. Unlike some of the other Unix::*File modules, this module will preserve the order of your alias file, with a few exceptions. Comments and aliases will appear in the file in the same order that they started in, unless you have comment lines interspersed between the beginning of an alias and continuation lines for that same alias. In this case, those comments will appear after the alias that contains them.
METHODS
add_user( ALIAS, @USERS ) This method will add the list of users to an existing alias. Users that are already members of the alias are silently ignored. The special alias name * will add the users to every alias. Returns 1 on success or 0 on failure. alias( ALIAS [,@USERS] ) This method can add, modify, or return information about an alias. Supplied with a single alias parameter, it will return a list consisting of the members of that alias, or undef if no such alias exists. If you supply more parameters, the named alias will be created or modified if it already exists. The member list is also returned to you in this case. aliases( ) This method returns a list of all existing aliases. The list will be sorted in alphabetical order. In scalar context, this method returns the total number of aliases. comment( ALIAS, COMMENT ) This method inserts a comment line before the specified alias. You must supply your own comment marker (#) but a newline will be automatically appended to the comment unless it already has one. Returns 1 on success and 0 on failure. commit( [BACKUPEXT] ) See the Unix::ConfigFile documentation for a description of this method. delempty( ) This method will delete all existing aliases that have no members. It returns a count of how many aliases were deleted. delete( ALIAS ) This method will delete the named alias. It has no effect if the supplied alias does not exist. new( FILENAME [,OPTIONS] ) See the Unix::ConfigFile documentation for a description of this method. remove_user( ALIAS, @USERS ) This method will remove the list of users from an existing alias. Users that are not members of the alias are silently ignored. The special alias name * will remove the users from every alias. Returns 1 on success or 0 on failure. rename_user( OLDNAME, NEWNAME ) This method will change one username to another in every alias. Returns the number of aliases affected. uncomment( COMMENT ) Remove the comment from the file that matches the supplied text. The match must be exact. Returns 1 on success and 0 on failure.
BUGS
While the Unix::AliasFile module will work with Perl versions prior to 5.005, it may exhibit a minor bug under those versions. The bug will cause program aliases with embedded comma characters to be broken apart. This will not happen under 5.005 and up, due to the use of the Text::ParseWords module, which changed significantly with the 5.005 release.
AUTHOR
Steve Snodgrass, ssnodgra@fore.com
SEE ALSO
Unix::AutomountFile, Unix::ConfigFile, Unix::GroupFile, Unix::PasswdFile