7 DirHandle - supply object methods for directory handles
12 $d = new DirHandle ".";
14 while (defined($_ = $d->read)) { something($_); }
16 while (defined($_ = $d->read)) { something_else($_); }
22 The C<DirHandle> method provide an alternative interface to the
23 opendir(), closedir(), readdir(), and rewinddir() functions.
25 The only objective benefit to using C<DirHandle> is that it avoids
26 namespace pollution by creating globs to hold directory handles.
34 On Mac OS (Classic), the path separator is ':', not '/', and the
35 current directory is denoted as ':', not '.'. You should be careful
36 about specifying relative pathnames. While a full path always begins
37 with a volume name, a relative pathname should always begin with a
38 ':'. If specifying a volume name only, a trailing ':' is required.
49 @_ >= 1 && @_ <= 2 or croak
'usage: new DirHandle [DIRNAME]';
53 DirHandle
::open($dh, $_[0])
65 @_ == 2 or croak
'usage: $dh->open(DIRNAME)';
66 my ($dh, $dirname) = @_;
67 opendir($dh, $dirname);
71 @_ == 1 or croak
'usage: $dh->close()';
77 @_ == 1 or croak
'usage: $dh->read()';
83 @_ == 1 or croak
'usage: $dh->rewind()';