5 DirHandle - supply object methods for directory handles
10 $d = new DirHandle ".";
12 while (defined($_ = $d->read)) { something($_); }
14 while (defined($_ = $d->read)) { something_else($_); }
20 The C<DirHandle> method provide an alternative interface to the
21 opendir(), closedir(), readdir(), and rewinddir() functions.
23 The only objective benefit to using C<DirHandle> is that it avoids
24 namespace pollution by creating globs to hold directory handles.
33 @_ >= 1 && @_ <= 2 or croak 'usage: new DirHandle [DIRNAME]';
37 DirHandle::open($dh, $_[0])
49 @_ == 2 or croak 'usage: $dh->open(DIRNAME)';
50 my ($dh, $dirname) = @_;
51 opendir($dh, $dirname);
55 @_ == 1 or croak 'usage: $dh->close()';
61 @_ == 1 or croak 'usage: $dh->read()';
67 @_ == 1 or croak 'usage: $dh->rewind()';