Alias(3)

πŸ“¦
version 1.15 Β· 2 versions
, in fedora 43

✨ 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 named aliases, 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 the read(), write() and format() methods with this one.
  • usefile () β€” sets the working mode to use files (direct access). use the append() and delete() 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 (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