fix: return true from BINMODE on mocked filehandles#319
Merged
toddr merged 1 commit intocpan-authors:masterfrom Mar 23, 2026
Merged
fix: return true from BINMODE on mocked filehandles#319toddr merged 1 commit intocpan-authors:masterfrom
toddr merged 1 commit intocpan-authors:masterfrom
Conversation
BINMODE returned undef (bare return;) instead of 1, causing any binmode($fh) or die pattern to fail on mocked files. This broke File::Copy::copy() with mocked files since File::Copy checks binmode's return value. Fixes cpan-authors#310 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
toddr
approved these changes
Mar 23, 2026
toddr
added a commit
that referenced
this pull request
Mar 23, 2026
fix: return true from BINMODE on mocked filehandles
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
BINMODEnow returns1instead ofundefon mocked filehandles.Why
The bare
return;inBINMODEcausedbinmode($fh) or diepatterns to fail, which brokeFile::Copy::copy()with mocked files (File::Copy line ~149 checks binmode's return).How
One-line fix:
return;→return 1;inFileHandle.pm.Testing
New
t/binmode.twith 3 subtests covering plain binmode, binmode with encoding layer, and theor diepattern. Full suite passes (1556 tests, only pre-existingfh-ref-leak.tfailure).Fixes #310
🤖 Generated with Claude Code