AFS(3) Basic functions and variables of the AFS module


use AFS qw (
afsok checkafs constant
error_message raise_exception
my $acl = getacl($path);
if (afsok) ....
$old = raise_exception(1);
... make some calls you want to raise exceptions for
... there is an error
$mess = error_message($code);
$value = constant('PRIDEXIST'); # value = 267265
$value = &AFS::PRIDEXIST; # value = 267265, preferred method
if ($AFS::CODE eq "User or group doesn't exist") ....
if ($AFS::CODE == &AFS::PRNOENT) ....


This document describes the special variables and convenience functions available from the AFS module. You can convert error codes into error messages. It is possible to activate exception handling for the AFS system calls. You can retrieve the values for AFS constants. Any function required must by explicitly listed by the "use" statement to be exported into the calling package.


This release does NOT support any features and interfaces from version 1.

Special Variables

The special variable $AFS::CODE contains the status value of the last AFS function call. A non-zero value indicates an error occurred, while a zero indicates success. This variable is magical. (like the $! variable) If you reference it as a string you will get an error message, and if you reference it as a numeric value (use the int() function or add 0 to it) it will equal the numeric error code.


Standard Exports


Optional Exports

The following functions will be exported into your namespace if you specifically ask that they be imported.
Convenience function that calls die and prints an error message if $AFS::CODE is not equal to 0. Used mainly for debugging.
if (afsok) { ... }
Convenience function that returns true if $AFS::CODE is equal to 0
$cur_raise_flg = raise_exception([NEW]);
If NEW is set to 1, then a Perl exception will be raised whenever an error is returned from an AFS function call. This is used mainly for debugging and testing.
$msg = error_message(NUM_CODE);
Converts numeric code NUM_CODE into an error string.
$val = constant(NAME);
Converts a constant NAME (i.e, #define) into scaler. Returns undef for unknown constants.
$val = &AFS::CONSTANT;
All values referenced through the constant function can be referenced as functions in the AFS package. This is the preferred way of accessing constants.


Norbert E. Gruener  <[email protected]>.


Roland Schemers  <[email protected]>.


 X 2001-2008 Norbert E. Gruener <[email protected]>.
 All rights reserved.
 X 1994 Board of Trustees, Leland Stanford Jr. University.
 All rights reserved.

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

The original module is covered by the following copyright:
Copyright (c) 1994 Board of Trustees, Leland Stanford Jr. University

Redistribution and use in source and binary forms are permitted provided that the above copyright notice and this paragraph are duplicated in all such forms and that any documentation, advertising materials, and other materials related to such distribution and use acknowledge that the software was developed by Stanford University. The name of the University may not be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.


Revision $Rev: 859 $