fix: correct IO.pm error messages and remove Timer.pm dead code - #295
Draft
toddr-bot wants to merge 1 commit into
Draft
fix: correct IO.pm error messages and remove Timer.pm dead code#295toddr-bot wants to merge 1 commit into
toddr-bot wants to merge 1 commit into
Conversation
IO.pm _new_internal() error messages referenced $_ (the caller's topic variable) instead of $type. When called via IO->new(), $_ was whatever the calling scope happened to have, producing misleading error messages like "'' missing a source". Use $type so the operator is always shown. Timer.pm check() had an unreachable guard: line returned 0 if is_expired, but the preceding line already returned undef for all non-running timers (which includes expired ones). The actual "expires during this check" case is handled later by expire()+return 0. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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
Fix misleading error messages in IO.pm and remove unreachable dead code in Timer.pm.
Why
IO.pm:
_new_internal()error messages referenced$_(the caller's topic variable) instead of the$typeparameter. When called viaIO->new(),$_was whatever the calling scope had, producing messages like'' missing a sourceinstead of'<' missing a source.Timer.pm:
check()line 365 (return 0 if $self->is_expired) was unreachable — line 364 already returnsundeffor all non-running timers, which includes expired ones (state=undef). The "expires during this check" case is correctly handled later at lines 376-377 viaexpire()+return 0.How
$_with$typein both error messages (lines 150, 173)$_Testing
prove -Ilib t/io.t t/timer.t— all pass. Full suite: 863/863 pass (pty.t skipped due to IO::Pty version).