File::MailAlias - Domain model for the system mail aliases file
0.16.$Rev: 1 $
use File::MailAlias; my $alias_obj = File::MailAlias->new( $alias_attributes );
Domain model for the system mail aliases file. Extends File::DataClass::Schema
Defines these attributes:
commit
Boolean indicating whether source code control tracking is being used. Defaults to false
false
commit_cmd
newaliases
path
Path to the copy of the aliases file that this module works on. Defaults to aliases in the ctrldir
aliases
ctrldir
prog
Path to the appname_misc program which is optionally used to commit changes to the local copy of the aliases file to a source code control repository
appname
new_aliases
Path to the newaliases program that is used to update the mail transfer agent when changes are made
result_source_attributes
root_update_attrs
root_update_cmd
source_name
suid
Path to the suid root wrapper program that is called to enable update access to the real mail alias file
system_aliases
The real mail alias file. Defaults to /etc/mail/aliases
Defines the following methods modifiers
BUILDARGS
resultset
$alias_obj->aliases_map;
Returns a hash ref of aliases. Caches the result and updates automatically by reading the cache mod time
$alias_obj->create( { name => $name, fields => $fields } );
Create a new mail alias. Passes the fields to the suid root wrapper on the command line. The wrapper calls the "update_as_root" method to get the job done. Adds the text from the wrapper call to the results section on the stash
$alias_obj->delete( { name => $name } );
Deletes the named mail alias. Calls "update_as_root" via the suid wrapper. Adds the text from the wrapper call to the results section on the stash
$email_address = $alias_obj->email_address( $username );
Takes a user returns a guess as to what the users email address might be
$f_dc_element_obj = $alias_obj->list( $name );
Initialises these attributes in the returned object
List of alias names
Creation comment associated with the selected alias
Date the selected alias was created
Who created the selected alias
List of recipients for the selected owner
$f_dc_list_obj = $alias_obj->list( $name );
Returns an object containing a list of alias names and the fields pertaining to the requested alias if it exists
$alias_obj->update( { name => $name, fields => $fields } );
Update an existing mail alias. Calls "update_as_root" via the suid wrapper
$alias_obj->update_as_root( $alias, $recipients, $owner, $comment );
Called from the suid root wrapper this method updates the local copy of the alias file as required and then copies the changed file to the real system alias file. It will also run the newaliases program and commit the changes to a source code control system if one is being used
None
There are no known incompatibilities in this module
There are no known bugs in this module. Please report problems to the address below. Patches are welcome
Peter Flanigan, <pjfl@cpan.org>
<pjfl@cpan.org>
Copyright (c) 2013 Peter Flanigan. All rights reserved
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See perlartistic
This program is distributed in the hope that it will be useful, but WITHOUT WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE
To install File::MailAlias, copy and paste the appropriate command in to your terminal.
cpanm
cpanm File::MailAlias
CPAN shell
perl -MCPAN -e shell install File::MailAlias
For more information on module installation, please visit the detailed CPAN module installation guide.