---
name: "Test::MockFile::DirHandle"
section: "3pm"
platform: "linux"
package: "libtest-mockfile-perl"
version: "0.037-1"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/Test::MockFile::DirHandle"
---

# Test::MockFile::DirHandle(3pm)

Provides a class object for Test::MockFile to give out for opendir calls.

## NAME

Test::MockFile::DirHandle - Provides a class object for Test::MockFile to give out for opendir calls.

## VERSION

Version 0.037

## SYNOPSIS

This is a helper class for Test::MockFile its only purpose is to provide a object to recognize that a the passed handle is a mocked handle. Test::MockFile has to mock the other calls since there is no tie for **opendir** handles.

```
    # This is what Test::MockFile does. You really shouldn't be doing it directly.
    use Test::MockFile::DirHandle;
    my $handle = Test::MockFile::DirHandle->new("/fake/path", [qw/. .. a bbb ccc dd/]);
```

## EXPORT

No exports are provided by this module.

## SUBROUTINES/METHODS

### new

Args: ($class, `$dir`, `$files_array_ref`)

Returns a blessed object for Test::MockFile::DirHandle. There are no error conditions handled here.

**NOTE:** the permanent directory contents are stored in a hash in Test::MockFile. However when opendir is called, a copy is stored here. This is because through experimentation, we've determined that adding files in a dir during a opendir/readdir does not affect the return of readdir.

See Test::MockFile.

## AUTHOR

Todd Rinaldo, `"<toddr at cpan.org>"`

## BUGS

Please report any bugs or feature requests to \<https://github.com/CpanelInc/Test-MockFile\>.

## SUPPORT

You can find documentation for this module with the perldoc command.

```
    perldoc Test::MockFile::DirHandle
```

You can also look for information at:

- •

  CPAN Ratings

  \<https://cpanratings.perl.org/d/Test-MockFile\>

- •

  Search CPAN

  \<https://metacpan.org/release/Test-MockFile\>

## LICENSE AND COPYRIGHT

Copyright 2018 cPanel L.L.C.

All rights reserved.

\<http://cpanel.net\>

This is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See perlartistic.
