GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
AliasFile(3) User Contributed Perl Documentation AliasFile(3)

Unix::AliasFile - Perl interface to /etc/aliases format files

  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;

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.

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.

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.

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.

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.

See the Unix::ConfigFile documentation for a description of this method.

This method will delete all existing aliases that have no members. It returns a count of how many aliases were deleted.

This method will delete the named alias. It has no effect if the supplied alias does not exist.

See the Unix::ConfigFile documentation for a description of this method.

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.

This method will change one username to another in every alias. Returns the number of aliases affected.

Remove the comment from the file that matches the supplied text. The match must be exact. Returns 1 on success and 0 on failure.

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.

Steve Snodgrass, ssnodgra@fore.com

Unix::AutomountFile, Unix::ConfigFile, Unix::GroupFile, Unix::PasswdFile
2000-05-02 perl v5.32.1

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.