Test::...rHandle(3pm)

πŸ“¦
version 0.039 Β· 4 versions
, in ubuntu stonking

✨ Test::MockFile::DirHandle β€” the whole vibe ✨

okay so bestie, welcome to the Test::MockFile::DirHandle page, from the User Contributed Perl Documentation corner of the internet πŸ’– This is the little helper class that rides shotgun with Test::MockFile.


🌸 NAME 🌸

Test::MockFile::DirHandle β€” it hands out a class object for Test::MockFile to give to your opendir calls. that's it. that's the job. πŸ‘‘


πŸŽ€ VERSION πŸŽ€

Version 0.039 β€” yes, current, yes, iconic.


πŸ¦‹ SYNOPSIS πŸ¦‹

so here's the tea β˜• β€” this is a helper class for Test::MockFile, and its only purpose is to give you an object so you can recognize that the handle you got passed is a mocked handle. That's the whole personality.

why does it have to exist at all? because Test::MockFile has to mock the other calls, since there is no tie for opendir handles. like, the tie machinery just doesn't go there, so this class picks up the slack πŸ’…

# 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/]);
reading that comment again: you really shouldn't be doing it directly. that's not me being dramatic, that's literally written in there. hands off, bestie πŸ™ˆ

πŸ’œ EXPORT πŸ’œ

No exports are provided by this module. zero. none. nothing's coming out of this box, no cap. 🎁


⭐ SUBROUTINES/METHODS ⭐

🫢 new

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

Returns a blessed object for Test::MockFile::DirHandle. There are no error conditions handled here β€” it's just gonna bless and vibe, it's not checking your work.

NOTE: the permanent directory contents live in a hash inside Test::MockFile. But when opendir gets called, a copy gets stored here instead. Why? Because through experimentation, it's been determined that adding files to a dir during an opendir/readdir does not affect what readdir returns. so the snapshot is taken at opendir time and that's the reality readdir lives in. periodt. πŸ“Έ

See Test::MockFile.


πŸ’– AUTHOR πŸ’–

Todd Rinaldo, "<toddr at cpan.org>" β€” credit where credit is due, king πŸ‘‘


🌈 BUGS 🌈

Please report any bugs or feature requests to:

<https://github.com/cpanel/Test-MockFile>

found a bug? not a you-problem to sit on, go tell the repo fr fr πŸ›βœ¨


🧚 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>


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.


and that's the whole page, bestie πŸ’… go forth and mock directories responsibly. πŸ¦‹

this little tour was brought to you by perl v5.40.1, dated 2026-03-27, straight from the Test::...rHandle(3pm) manual page β€” catch you in the next one 🌟

πŸ“¦ where this page comes from