Alias(3p)

NAME
Mail::Alias - Manipulates mail alias files of various formats. Works on files directly or loads files into memory and works on the buffer.

SYNOPSIS
    use Mail::Alias;

DESCRIPTION
"Mail::Alias" can read various formats of mail alias. Once an object has been created it can be used to expand aliases and output in another format.

CONSTRUCTOR

new () Alias objects can be created in two ways; With a format specified- Mail::Alias::Sendmail->new([filename]) Without a format specified- Mail::Alias->new([filename]}. Format defaults to SENDMAIL In either case, the filename is optional and, if supplied, it will be read in when the object is created. Available formats are Sendmail, Ucbmail, and Binmail.

METHODS

read () Reads an alias file of the specified format into memory. Comments or blank lines are lost upon reading. Due to storage in a hash, ordering of the alias lines is also lost.
write () The current set of aliases contained in the object memory are written to a file using the current format. If a filehandle is passed, data is written to the already opened file. If a filename is passed, it is opened and the memory is written to the file. Note: if passing a filename, include the mode (i.e. to write to a file named aliases pass >aliases). Before writing, the alias lines are sorted alphabetically.
format () Set the current alias file format.
exists () Indicates the presence of the passed alias within the object (if using memory access), or the current aliases file (if using direct file access). For direct file access, the return value is the address string for the alias.
expand () Expands the passed alias into a list of addresses. Expansion properly handles :include: files, recursion, and continuation lines. Only works when memory access is being used. If the alias is not found in the object, you get back what you sent.
alias_file () Sets or gets the name of the current alias filename for direct access.
append () *-Sendmail only-* Adds an alias to an existing Sendmail alias file. The alias and addresses can be passed as two separate arguments (alias, addresses) or as a single line of text (alias: addresses)
delete () *-Sendmail only-* Deletes the entry for an alias from the current alias file.
update () *-Sendmail only-* Replaces the address string entry for an alias in the current alias file.
usemem () Sets the working mode to use memory (indirect access). Use read(), write() and format() methods.
usefile () Sets the working mode to use files (direct access). Use append() and delete() methods.

MAINTAINER
Jonathan Kamens <jik@kamens.us> (CPAN author ID: JIK)

COPYRIGHT
Copyright (c) 2022 Jonathan Kamens <jik@kamens.us>. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

Portions of earlier versions of this program were copyrighted by Tom Zeltwanger and Graham Barr. The current copyright holder extends full authorship rights to both of the previous authors.