fix: validate command name type and fix Timer.pm POD errors - #296
Draft
toddr-bot wants to merge 1 commit into
Draft
fix: validate command name type and fix Timer.pm POD errors#296toddr-bot wants to merge 1 commit into
toddr-bot wants to merge 1 commit into
Conversation
Detect references (ARRAY, HASH, CODE) passed as command names inside the command arrayref early in the harness parser, before _search_path stringifies them into 'ARRAY(0x...)' producing a confusing "not found" error. Commonly triggered by accidentally nesting arrays: run [[cmd]] instead of run [cmd]. Fix Timer.pm SYNOPSIS examples: $t->time(5) is not a method — the correct call is $t->interval(5), and both instances were missing semicolons. Remove stale TODO about time parsing (already implemented in _parse_time). Clarify result() POD: document that signal-killed children also yield undef (since $? >> 8 is 0 for signal deaths), and point to full_result() for detecting signals.
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
Catch references passed as command names early in the harness parser, and fix Timer.pm documentation bugs.
Why
When users accidentally write
run [[cmd]]instead ofrun [cmd], the inner arrayref is stringified toARRAY(0x...)and produces the confusing errorCommand 'ARRAY(0x...)' not found in .... A validation check at parse time gives a clear diagnostic:Command name must be a string, not a ARRAY reference.Timer.pm's SYNOPSIS had two bugs:
$t->time(5)is not a method (the correct call is$t->interval(5)), and both instances were missing semicolons — meaning the next statement would be parsed as an argument.How
ref $_->[0]check after the existing!defined $_->[0]check in harness(), covering ARRAY, HASH, and CODE references.$t->time(5)→$t->interval(5);in Timer.pm SYNOPSIS (both timeout and timer examples)._parse_time).result()POD: signal-killed children also yield undef, with pointer tofull_result().Testing
t/bogus.tfor nested ARRAY, HASH ref, and CODE ref as command name.Quality Report
Changes: 3 files changed, 34 insertions(+), 9 deletions(-)
Code scan: clean
Tests: passed (OK)
Branch hygiene: clean
Generated by Kōan