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.
35 @_ >= 1 && @_ <= 2 or croak 'usage: new DirHandle [DIRNAME]';
39 DirHandle::open($dh, $_[0])
51 @_ == 2 or croak 'usage: $dh->open(DIRNAME)';
52 my ($dh, $dirname) = @_;
53 opendir($dh, $dirname);
57 @_ == 1 or croak 'usage: $dh->close()';
63 @_ == 1 or croak 'usage: $dh->read()';
69 @_ == 1 or croak 'usage: $dh->rewind()';