8.59. DirHandle
Provides
methods for accessing Perl''s directory functions,
avoiding namespace pollution. Creates anonymous glob to hold a
directory handle and closes the dirhandle automatically when the last
reference goes out of scope. The following methods are provided.
Constructor. Creates a new directory
$dh = new DirHandle [dirname]
handle. The optional directory name,
dirname, defaults to the current
directory.
Closes a directory handle; equivalent
$dh->close( )
to the closedir function.
Opens directory
$dh->open(dirname)
dirname; equivalent to the
opendir function.
Reads directory entries. Equivalent to
$dh->read( )
the readdir function. In scalar context, reads the
next directory entry; in list context, reads all entries.
Sets current position to beginning of
$dh->rewind( )
directory; equivalent to the rewinddir function.