NAME

OS2::Attrib - Get or set OS/2 file attributes

SYNOPSIS

use OS2::Attrib qw(get_attribs set_attribs);
$attribs = get_attribs($path);
set_attribs($attribs, $path1, $path2, ...);

DESCRIPTION

OS2::Attrib provides access to OS/2 file attributes. While the read-only attribute can be handled by chmod and stat, the hidden, system, and archive attributes cannot.

$attribs = get_attribs($path)

Returns the attributes of $path, or the empty string if $path does not exist. Attributes are returned as a five-character string in this format: "RHSAD". Each letter is replaced by an underscore (_) if the file does not have the corresponding attribute. (This is the same format as a 4OS2 directory listing.) The attributes are:

R  The file is read-only (not writable)
H  The file is hidden (does not appear in directory listings)
S  The file is a system file (does not appear in directory listings)
A  The file needs to be archived (it has changed since last backup)
D  The file is a directory
$count = set_attribs($attribs, $path1, [$path2, ...])

Sets the attributes of $path1, $path2, etc. You can either specify the complete set of attributes, or add and subtract attributes by using + and -. The case and order of the attributes is not important. For example, '-s+ra' will remove the system attribute and add the read-only and archive attributes. You should not use whitespace between attributes, although underscores are OK. See get_attribs for an explanation of the attribute values. You cannot change the directory attribute; if you specify it, it is ignored. Returns the number of files successfully changed.

AUTHOR

Christopher J. Madsen <ac608@yfn.ysu.edu>

SEE ALSO

The OS2::ExtAttr module provides access to extended attributes.