Alias(3)
β¨ Alias(3) β User Contributed Perl Documentation, but make it cute β¨
okay bestie, pull up a chair π this is the manual page for Mail::Alias, a lil Perl module from the User Contributed Perl Documentation section. it's giving "i handle your mail alias files for you" and honestly? we love that for us.
π NAME
Mail::Alias β manipulates mail alias files of various formats. it can work on files directly, or load files into memory and work on the buffer. two whole modes, no cap π«Ά
β¨ SYNOPSIS
use Mail::Alias;
that's it. that's the whole vibe check. π
πΈ 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. so you read one flavor, you write another flavor, and the module handles the glow-up. iconic behavior fr fr π₯
π CONSTRUCTOR
new ()
Alias objects can be created in two ways:
- With a format specified β like this:
Mail::Alias::Sendmail->new([filename])
- Without a format specified β like this:
Mail::Alias->new([filename]}
(yes, the curly brace in that second one is exactly how it's written in the original. copy it character for character and don't come for me π)
either way: format defaults to SENDMAIL, and the filename is optional. if you do supply it, it gets read in right when the object is created. convenient? yes. main character energy? also yes. π
the available formats are Sendmail, Ucbmail, and Binmail. pick your fighter. π
π METHODS
read ()β reads an alias file of the specified format into memory. lowkey important: comments and blank lines are lost upon reading. and because everything lives in a hash, the ordering of the alias lines is also lost. so if you were attached to your comment headers... rip bestie π they're gone.write ()β writes the current set of aliases sitting in the object's memory out to a file, using the current format. if you pass a filehandle, the data goes to the already-opened file. if you pass a filename, it gets opened and the memory gets written to it.
β οΈ note: if you're passing a filename, include the mode. like, to write to a file namedaliases, pass>aliases. don't skip this, it's not a suggestion π
before writing, the alias lines are sorted alphabetically. so it comes out neat and tidy. we stan organization. β¨
format ()β sets the current alias file format.exists ()β indicates the presence of the passed alias, either within the object (if you're using memory access) or within the current aliases file (if you're using direct file access). for direct file access, the return value is the address string for the alias. so it's not just a yes/no, it's a whole answer. π«Άexpand ()β expands the passed alias into a list of addresses. expansion properly handles:include:files, recursion, and continuation lines. fancy!! but heads up: this only works when memory access is being used. and if the alias isn't found in the object, you just get back what you sent. no alias, no problem, no notes. πΈ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. you can pass the alias and addresses as two separate arguments β(alias, addresses)β or as a single line of text β(alias: addresses). your call, bestie. π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 theread(),write()andformat()methods with this one.usefile ()β sets the working mode to use files (direct access). use theappend()anddelete()methods with this one.
so basically: memory mode = read() / write() / format(), file mode = append() / delete(). pick a lane, slay in it. π₯
π¦ 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. π«Ά
and that's the whole page!! this was Alias(3), brought to you by perl v5.42.0, dated 2025-07-25 β so if you need me, i'll be right here in the User Contributed Perl Documentation, periodt. π
β¨π
π¦ where this page comes from
- fedora 43: perl-Mail-Alias 1.15-11.fc43 Β· GPL-1.0-or-later OR Artistic-1.0-Perl
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms