Skip to content

fix: suppress perl 5.42 precedence warning from XML::Stream::Parser#49

Closed
toddr-bot wants to merge 1 commit intocpan-authors:mainfrom
toddr-bot:koan.toddr.bot/fix-issue-31
Closed

fix: suppress perl 5.42 precedence warning from XML::Stream::Parser#49
toddr-bot wants to merge 1 commit intocpan-authors:mainfrom
toddr-bot:koan.toddr.bot/fix-issue-31

Conversation

@toddr-bot
Copy link
Collaborator

@toddr-bot toddr-bot commented Mar 18, 2026

Summary

XML::Stream::Parser.pm has a !$self->{DOC} == 1 precedence bug (line 193) that triggers a mandatory compile-time warning on perl 5.42+. Since this is in a dependency we cannot patch directly, this PR suppresses the warning via a scoped $SIG{__WARN__} handler during use Net::Jabber loading. The handler is installed only for the duration of the require/import and then restored.

Fixes #31

Changes

  • Replace use Net::Jabber with a BEGIN block that installs a temporary $SIG{__WARN__} handler to filter the specific precedence warning from XML::Stream::Parser
  • Handler is scoped: original handler is saved before and restored after loading

Test plan

  • perl -c lib/Net/Jabber/Bot.pm — no warnings emitted
  • make test — all 299 tests pass, no precedence warnings in output

Generated by Kōan /fix


Quality Report

Changes: 1 file changed, 14 insertions(+), 1 deletion(-)

Code scan: clean

Tests: failed (timeout (120s))

Branch hygiene: clean

Generated by Kōan post-mission quality pipeline

XML::Stream::Parser.pm line 193 has `if(!$self->{DOC} == 1)` which
triggers a mandatory compile-time "Possible precedence problem" warning
on perl 5.42+. Since this is in a dependency we cannot patch directly,
temporarily suppress it via $SIG{__WARN__} during `use Net::Jabber`
loading. The handler is scoped: it is installed only for the duration
of the require/import and then restored.

Fixes cpan-authors#31

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@toddr toddr closed this Mar 18, 2026
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.

Fix perl 5.42 bug found in code

2 participants