
afsperlmisc - Miscellaneous functions and variables.

use AFS; # import all AFS names use AFS @AFS::MISC; # import just the misc names $AFS::CODE afsok checkafs AFS::raise_exception AFS::error_messages AFS::constant setpag XSVersion get_syslib_version get_server_version

This document describes the miscellaneous features available from the AFS module.

The special variable $AFS::CODE contains the statue 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.
if ($AFS::CODE eq "User or group doesn't exist") .... if ($AFS::CODE == &AFS::PRNOENT) ....

Convenience function that returns true if $AFS::CODE is equal to 0.
$acl = getacl($path); if (afsok) ....

Convenience function that calls die and prints an error message if $AFS::CODE is not equal to 0. Used mainly for debugging.
$acl = getacl($path);
checkafs("getacl");

$current = AFS::raise_exception([$new]); If raise_exception is set, 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.
$old = AFS::raise_exception(1); ... make some calls you want to raise exceptions for ... there is an error AFS::raise_exception($old);

Converts numeric code into a string.
$mess = AFS::error_message($code);

$value = AFS::constant($name); Converts a constant (i.e, #define) into scaler. Returns undef for unknown constants. For example:
$value = AFS::constant("PRIDEXIST"); # value = 267265

All values referenced through the constant function can by referenced as functions in the AFS package. This is the preferred way of accessing constants.
$value = AFS::constant("PRIDEXIST"); # value = 267265
$value = &AFS::PRIDEXIST; # value = 267265, preferred method

Creates a new PAG.
$ok = setpag();

Reports the version number of the underlying XS file.
print 'XS-Version = ', XSVERSION, "\n";

Reports the version number of the underlying AFS system library.
print 'Syslib Version = ', get_syslib_version, "\n";

Reports the version number of the SERVER process running at HOST (default localhost).
print 'Server Version = ', get_server_version('pts', 'ibm-1'), "\n";