Skip to content

Adapt to PPI 1.286 (check for defined code before passing to PPI::Doc…#12

Open
jplesnik wants to merge 1 commit into
yanick:releasesfrom
jplesnik:releases
Open

Adapt to PPI 1.286 (check for defined code before passing to PPI::Doc…#12
jplesnik wants to merge 1 commit into
yanick:releasesfrom
jplesnik:releases

Conversation

@jplesnik

@jplesnik jplesnik commented Jun 1, 2026

Copy link
Copy Markdown

…ument->new)

PPI 1.286 refactored PPI::Lexer::lex_source() for a performance fix (GH#318). The old version explicitly rejected undef input with "unless ( defined $source and not ref $source )". The new version removed this check, so PPI::Document->new(\undef) now returns a valid empty PPI::Document instead of failing.

This caused PPIx::EditorTools::process_doc() to silently succeed when called without valid ppi or code arguments, because PPI::Document->new($code) with undef $code now creates a valid empty document.

Fix by guarding the PPI::Document->new() call with a defined check on $code, and by dropping the @subs argument from use_ok() since the module doesn't export anything.

…ument->new)

PPI 1.286 refactored PPI::Lexer::lex_source() for a performance fix (GH#318).
The old version explicitly rejected undef input with
"unless ( defined $source and not ref $source )". The new version removed
this check, so PPI::Document->new(\undef) now returns a valid empty
PPI::Document instead of failing.

This caused PPIx::EditorTools::process_doc() to silently succeed when called
without valid ppi or code arguments, because PPI::Document->new(\$code)
with undef $code now creates a valid empty document.

Fix by guarding the PPI::Document->new() call with a defined check on $code,
and by dropping the @subs argument from use_ok() since the module doesn't
export anything.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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.

1 participant