DirHandle(3perl) Perl Programmers Reference Guide DirHandle(3perl)
NAME
DirHandle - (obsolete) supply object methods for directory handles
SYNOPSIS
# recommended approach since Perl 5.6: do not use DirHandle
if (opendir my $d, '.') {
while (readdir $d) { something($_); }
rewind $d;
while (readdir $d) { something_else($_); }
}
# how you would use this module if you were going to
use DirHandle;
if (my $d = DirHandle->new(".")) {
while (defined($_ = $d->read)) { something($_); }
$d->rewind;
while (defined($_ = $d->read)) { something_else($_); }
}
DESCRIPTION
There is no reason to use this module nowadays.
The "DirHandle" method provide an alternative interface to the opendir(), closedir(),
readdir(), and rewinddir() functions.
Up to Perl 5.5, opendir() could not autovivify a directory handle from "undef", so using a
lexical handle required using a function from Symbol to create an anonymous glob, which
took a separate step. "DirHandle" encapsulates this, which allowed cleaner code than
opendir(). Since Perl 5.6, opendir() alone has been all you need for lexical handles.
perl v5.34.0 2025-07-25 DirHandle(3perl)
Generated by $Id: phpMan.php,v 4.55 2007/09/05 04:42:51 chedong Exp $ Author: Che Dong
On Apache
Under GNU General Public License
2026-01-10 16:27 @216.73.216.127 CrawledBy Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)