Revision history for Test-MockFile
0.038 3/20/2026
[Improvements]
- GH #70 - Auto-update stat timestamps (atime/mtime/ctime) during file
operations. PR #288
- GH #186 - Auto-update parent directory mtime on content changes. PR #288
- GH #3 - Add permission checking via set_user/clear_user. PR #281
- GH #44 - Add autodie compatibility with proper exception throwing.
- GH #16 - Add symlink() and link() overrides for mocked files.
- GH #24 - Add warnstrict mode for non-fatal strict violations.
- GH #39 - Override IO::File::open for mocked file compatibility.
- GH #135 - Add autovivify option for directory mocks.
- GH #139 - Override Cwd::abs_path to resolve mocked symlinks.
- GH #112 - Add flock() override for mocked files.
- GH #221 - Add truncate() override for mocked files.
- GH #111 - Add read(), write(), and append() helper methods.
- GH #27 - Support multiple file handles to the same mocked file.
- GH #158 - glob() now falls back to real filesystem for unmocked paths.
- GH #108 - Resolve . and .. in middle of paths.
- Add utime() override for mocked files.
- Add rename() override for mocked files.
- Implement SEEK whence support (SEEK_SET, SEEK_CUR, SEEK_END).
- Rewrite READLINE to support all $/ modes and implement GETC.
- Add :trace import tag for logging unmocked file accesses.
- Add file_passthrough() for strict-mode-compatible real filesystem
access with glob pattern support. PR #280
[Bug Fixes]
- GH #175 - Accept both EINVAL and ENOENT for readlink(undef).
- GH #179 - Fix filehandle reference leak. PR #276
- PRINT/PRINTF return false when weakened data ref is gone. PR #283
- Decrement nlink on unlink and preserve inode/nlink on rename. PR #276
- Set realistic nlink and unique inode defaults for mocked files.
- chmod/chown/utime/truncate now follow symlinks per POSIX. PR #287
- Use & ~umask instead of ^ umask for permission masking (multiple
locations).
- chown -1 now preserves per-file uid/gid instead of replacing with
process identity.
- Mask chmod mode with S_IFPERMS to prevent file type corruption.
- Use proper S_IFMT mask in is_link() to avoid false positives.
- Broken symlink stat sets ENOENT, not ELOOP.
- Use Errno constants instead of hardcoded errno values.
- PRINT writes at tell position instead of always appending.
- PRINT returns boolean 1, not byte count.
- Handle output record separator ($\) in PRINT for say() support.
- Update tell position after PRINT/WRITE/PRINTF operations.
- syswrite/printf must not inherit $\ from PRINT delegation.
- 2-arg open no longer dies on filenames with special characters.
- 2-arg open +>> mode parsing and opendir symlink following.
- readdir returns empty list (not undef) at EOF in list context.
- FileHandle CLOSE/DESTROY crash, WRITE negative offset, READ EBADF.
- Guard weakened data ref in tied filehandle methods.
- readline and getc on write-only handles now warn and return undef.
- READ returns EBADF on write-only handles, symlink size() returns
target length.
- sysopen without O_CREAT returns ENOENT for all modes.
- Allow seek past EOF and correct eof() behavior.
- seekdir with negative position no longer corrupts readdir.
- closedir double-close returns EBADF instead of passing to CORE.
- Dir ops on closed mock dirhandle warn instead of dying.
- Rename directory now re-keys children in mock registry.
- Rename directory over non-empty directory returns ENOTEMPTY.
- Rename to self no longer destroys file contents.
- Directory size() returns blksize instead of stringified arrayref.
- dir() constructor counts non-existent child mocks as content.
- rmdir ignores non-existent mock entries in directory.
- Set errno in __rmdir for undef path argument.
- unlink with no args now uses $_ for mocked files.
- Absolutify paths in _files_in_dir and _update_parent_dir_times.
- readlink returns ENOENT for non-existent mocks.
- lstat on unlinked symlink now returns ENOENT instead of stale stat.
- IO::File open on directory mocks returns EISDIR, append mode preserved.
- open/sysopen through broken symlink creates target file.
- Validate sysread length and return EINVAL on invalid seek whence.
- Correct blocks() calculation and remove dead code.
- Define S_IFPERMS locally instead of importing from Fcntl.
- Capture -s result before passing to is() for Perl < 5.16 compat.
- Apply permissions from sysopen O_CREAT 4th argument.
- Correct bareword check typo $_[9] -> $_[0] in dir functions.
- Pass missing args in chmod/chown passthrough to CORE.
- chown/chmod with broken symlinks no longer confess on multi-file lists.
- Use return undef in failure paths for correct list context.
- Truncate via read-only filehandle returns EINVAL.
- Add EISDIR checks, sysopen symlink following, and O_TRUNC dedup.
[Maintenance]
- Modernize CI workflow: upgrade checkout action and add Perl 5.40-5.42.
- Fix CI workflow permissions for code scanning. PR #284
- Refactor: improve readability and reduce duplication in MockFile.pm.
PR #284
- Add syswrite/sysread edge case test coverage. PR #282
- Correct MIN_PERL_VERSION and stale GitHub org URLs.
- Fix typos in error message and POD.
0.037 4/15/2025
- Fix unit test broken in perl 5.41.4
0.036 7/26/2023
- GH #181 - Detect incorrect usage of add_strict_rule_for_command
0.035 11/30/2022
- GH #180 - Prevent open() and sysopen() from opening GLOB(..)-like paths.
0.034 4/25/2022
- GH #176: Add file handle support for BINMODE. This does nothing at this
time but at least it doesn't die.
- support for ~/foo and ~user/foo in mocking and access (globs)
0.033 3/7/2022
- Request last Overload::FileCheck release - 0.013
- Correct chown parameter position for file name
- Fixup Plugin for File::Temp tempfile in scalar context logic.
- Track File::Temp version in unit tests.
0.032 2/24/2022
- Less strict mode - Don't complain about commands not opening or directly interacting with a file.
0.031 2/24/2022
- Fix for Plugin::FileTemp when calling tempfile in scalar context
0.030 2/22/2022
- Simplify _strict_mode_violation
- Introduce new_dir() to allow older dir() syntax.
- Provide a mechanism to setup custom strict rules
- Make is_strict_mode a helper
- Do not call _get_file_object when all we're trying to determine is if the file is mocked or not.
- Add Test::MockFile::Plugins
- We support "undef" as filename in strict rules to ignore filenames
- Block Plugin::FileTemp < 5.28
- Update MANIFEST
0.029 2/16/2022
- Fix broken link to small test documentation
- Ensure strict mode is enabled by default and prevent import conflicts.
- Fix warnings during global destruction
- Additional rules for _abs_path_to_file
- GH #103 - Update eg/example.pl:
- Add rmdir, mkdir and unlink default position
- Postpone file arg check during strict mode analysis
- Fixup hook args and teach for mkdir filename pos
- Perltidy policy changes.
- Use carp in filename and readlink
- Fix broken link to small test documentation
0.028 2/12/2022
- Update test for our FreeBSD results
- GH #122 - Support two-arg open, read/write, and understand pipes
- Add strict guards for additional keywords: readdir, telldir, rewinddir,
seekdir, closedir, readlink, mkdir, rmdir
- Revert to old symbol resolution technique.
0.027 2/10/2022
- GH #75 - Strict mode is now on by default
- GH #45 - Provide a helpful error message and document fileno unsupported.
- GH #90 - Normalize forward slashes.
- GH #126 - Document using debugger under strict mode.
- Do not hard-code values of $!
- Try to get more data when t/runtime-bareword-filehandles.t fails on cpan testers.
- GH #64 - Do not overwrite the error code when checking for Docker
- GH #63 - FreeBSD's readlink() returns EINVAL for readlink(undef):
- Add more data for debugging test failures on OpenBSD
0.026 2/3/2022
- Fix support for mocking the top-level directory.
- Symlinks should appear in readdir
- Fix directory instantiation when creating a symlink.
- GH #105: Show directories in readdir
- Improve relative path management
- Don't let stat() get confused with trailing forward slash
- GH #118: Do not get confused by inner directory files.
- GH #85: Do not corrupt blessed handles.
0.025 1/26/2022
- Fix typo in chmod mock. Was accidentally calling chown.
- Fix dependency on Text::Glob. It is now a runtime requirement.
0.024 1/24/2022
- Prefer Carp::confess to die
- Do not use "$!" in tests as it's not consistent across platforms
- GH #78: Do not allow rmdir on a populated directory.
- GH #73: Prefer the term ->path to ->filename as it is more clear between file/dir
- chown $fh now works.
- Only warn about mixed files when using mocked files
0.024_01
- GH #83: Get Solaris testers passing.
- Remove all use of "$!" in tests as this has tranlation problems.
0.023 1/14/2022
- GH #58: Fix synopsis typos
- GH #65: Fix typos in the typo fixes.
- GH #34: Support open() with barewords
- GH #59: Detect and reject common path mistakes when mocking
- GH #69: Redesigned dir() (and some file()) interface <--- breaks previous interface
- GH #40: Support glob()
- GH #15: Implement chown/chmod
0.022 12/27/2021
- GH #47: Manage bareword filehandles in runtime:
0.021 1/30/2020
- Emit ENOTDIR on opendir when appropriate
- Switch to github actions for CI testing
0.020 10/14/2019
- GH #51 - Basic introduction of file ownership. Set default uid/gid to current user when not set
- GH #49 - Make sysseek return position when called while allowing seek to return a true value.
0.19 5/21/2019
- Fix POD for stat example in POD.
- Allow scalar file handles on open. We don't care about those
- Provide better guidance about keeping your mocks in scope in examples
- Disable Test::CheckManifest due to break in Test-CheckManifest
- Fix seek bug in sysopen(... O_APPEND)
0.018 1/24/2019
- Properly handle open and sysopen file handles going out of scope.
- Provide a helper method to mock objects to determine the file name. GH #31
- Do not throw a file access hook when statting a file handle that is not under MockFile control. GH #30
- Read multiple lines via readline when wantarray is true. GH #29
0.017 1/2/2019
- Require a newer Test2::Bundle::Extended (0.000084) to support named isa_ok
0.016 1/2/2019
- Bump Overload::FileCheck to 0.007 to address stack bug
- Try to get EISDIR handling for BSD working. Apparently something changed in perl 5.20?
- Do not do access hooks on filehandle interactions.
0.015 12/21/2018
- Remove errant debug messages from open
- Pass 3 to fix t/touch.t on BSD.
0.014 12/20/2018
- Re-factor _find_file_or_fh to handle symlink following logic better. GH #26
- Make more standard use of _get_file_object when looking up a file path so we
properly handle abs path and symlink following
0.013 12/20/2018
- Add a helper to determine if goto can be used. Where it's available is complicated
- First pass at bareword file handles for opendir and friends
- Fix errant docs for making a symlink mock
- Follow links for stat but not lstat
- Add support for readlink
- Try 2 to fix BSD issues with GH #20
0.012 11/16/2018
- Fix for #21 - length undef on perl 5.10
- GH #20 - Add EPERM support for freebsd when unlinking directories
- Fix for print $fh undef throwing a warning
- Remove faulty OS level test of readdir after opendir.
0.011 11/08/2018
- Fix for my $file_contents = do { local $/; <$fh> };
- Mock CORE::GLOBAL::unlink and support directories for unlink
- Mock CORE::GLOBAL::mkdir
- Mock CORE::GLOBAL::rmdir
- MockFile->symlink now follows the symlink norm of ($target, $file), not the reverse.
- New mock helper 'exists' to check if the file is there.
- New mock helper 'permissions' tells you the current permissions of the mocked file.
0.010 10/31/2018
- Add .perltidyrc policy
- When reporting strict mode violations, be sure to report the a stack location outside of our modules.
- Report a stack trace for strict mode violations to determine the source of the problem.
- Add an ignore hash for modules (like DynaLoader) which are allowed to open files.
- Ignore STDIN/STDERR/STDOUT since tests often have to manipulate them and that's not really IO.
- Autovivify a sysread where the buffer passed in is undef.
0.009 10/29/2018
- Add unlink and touch as helpers when testing
- Depend on new Overload::FileCheck 0.006 which does not call MockFile to determine _ stats
0.008 10/26/2018
- Depend on newest Overload::FileCheck version. Depending on older
versions was breaking unit tests.
0.007 10/25/2018
- More POD fixups
- Support for unmocked file access hooks.
- Implement strict mode to error any time an unmocked file access happens.
0.006 10/25/2018
- Fix for Locale-dependent failures on perl < 5.22
https://github.com/CpanelInc/Test-MockFile/issues/10
- Minor pod fixups.
0.005 10/24/2018
- Complete basic documentation for all public methods.
0.004 10/24/2018
- Raise the Test::More requirement to address an issue with Test2::Formatter::TAP
Fixes https://github.com/CpanelInc/Test-MockFile/issues/6
0.003 10/24/2018
- Correct bug in use constant statement. 0.002 was broken on release.
- Changes to code to give basic support for Perl 5.10+. Ideally you should be on
perl 5.16 to run this code but it'll mostly work below that.
0.002 10/24/2018
- Set bug tracker to github
- Fix Fcntl bug when you use unsupported constants.
0.001 10/23/2018
- First release with basic support for open/sysopen/opendir
- Support is limited to Perl 5.20 until we address this error:
Error: Invalid CODE attribute: prototype(*;$@) at lib/Test/MockFile.pm