Skip to content

fix: return true from BINMODE on mocked filehandles#319

Merged
toddr merged 1 commit intocpan-authors:masterfrom
toddr-bot:koan.toddr.bot/fix-issue-310
Mar 23, 2026
Merged

fix: return true from BINMODE on mocked filehandles#319
toddr merged 1 commit intocpan-authors:masterfrom
toddr-bot:koan.toddr.bot/fix-issue-310

Conversation

@toddr-bot
Copy link
Copy Markdown
Collaborator

What

BINMODE now returns 1 instead of undef on mocked filehandles.

Why

The bare return; in BINMODE caused binmode($fh) or die patterns to fail, which broke File::Copy::copy() with mocked files (File::Copy line ~149 checks binmode's return).

How

One-line fix: return;return 1; in FileHandle.pm.

Testing

New t/binmode.t with 3 subtests covering plain binmode, binmode with encoding layer, and the or die pattern. Full suite passes (1556 tests, only pre-existing fh-ref-leak.t failure).

Fixes #310

🤖 Generated with Claude Code

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 toddr marked this pull request as ready for review March 23, 2026 17:37
@toddr toddr merged commit da3835b into cpan-authors:master Mar 23, 2026
19 checks passed
toddr added a commit that referenced this pull request Mar 23, 2026
fix: return true from BINMODE on mocked filehandles
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

BINMODE returns undef instead of true value, breaks File::Copy

2 participants