Filesys::POSIX::Directory - Base class for implementing directory structures
Filesys::POSIX::Directory is a common interface used to implement classes that act like directories, and should be able to be accessed randomly or in an iterative fashion.
Classes which wish to implement the interface documented herein should provide implementations for ALL methods listed in this document, in the manner in which they are described within this document.
$directory->get($name)
If the current directory contains an item named for $name, return the corresponding inode. Otherwise, an undef is returned.
$name
undef
$directory->set($name, $inode)
Store a reference to $inode in the current directory, named after the member label $name. If an item already exists for $name, then it will be replaced by $inode.
$inode
$directory->exists($name)
Returns true if a member called $name exists in the current directory. Returns false if no such member inode is listed.
$directory->detach($name)
Drop any references to a member called $name in the current directory. No side effects outside of the directory object instance shall occur.
$directory->delete($name)
Drop any references to a member called $name in the current directory. Side effects to other system resources referenced by this directory member may potentially occur, depending on the specific directory implementation.
$directory->list()
Return a list of all items in the current directory, including . and ...
.
..
$directory->count()
Return the number of all items in the current directory, including . and ...
$directory->empty()
Returns true if the directory only contains the . and .. entries.
$directory->open()
Prepare the current directory object for iterative reading access.
$directory->rewind()
Rewind the current directory object to the beginning of the directory list when being accessed iteratively.
$directory->read()
Read and return a single item from the directory, advancing the pointer to the next item to be read, if any. A list containing both the name of the object, and the inode it references, are returned.
$directory->close()
Close the current directory for iterative access.
$directory->rename_member()
Rename an item from one Filesys::POSIX::Directory so that it becomes a member of another Filesys::POSIX::Directory and/or changes name.
Written by Xan Tronix <xan@cpan.org>
Copyright (c) 2014, cPanel, Inc. Distributed under the terms of the Perl Artistic license.
To install Filesys::POSIX, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Filesys::POSIX
CPAN shell
perl -MCPAN -e shell install Filesys::POSIX
For more information on module installation, please visit the detailed CPAN module installation guide.