Skip Menu |

This queue is for tickets about the XS-Parse-Sublike CPAN distribution.

Report information
The Basics
Id: 132821
Status: resolved
Priority: 0/
Queue: XS-Parse-Sublike

People
Owner: Nobody in particular
Requestors: skaji [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: 0.10



Subject: XS-Parse-Sublike with "perl -w" emits warnings
I sometimes check perl scripts by running "perl -wc script.pl". Currently scripts that use XS::Parse::Sublike emit warnings: ``` ❯ perl -MXS::Parse::Sublike -wce1 Name "XS::Parse::Sublike::REGISTER" used only once: possible typo at /Users/skaji/env/plenv/versions/5.30.3/lib/perl5/5.30.3/XSLoader.pm line 114. Name "XS::Parse::Sublike::ABIVERSION" used only once: possible typo at /Users/skaji/env/plenv/versions/5.30.3/lib/perl5/5.30.3/XSLoader.pm line 114. Name "XS::Parse::Sublike::PARSE" used only once: possible typo at /Users/skaji/env/plenv/versions/5.30.3/lib/perl5/5.30.3/XSLoader.pm line 114. Name "XS::Parse::Sublike::PARSEANY" used only once: possible typo at /Users/skaji/env/plenv/versions/5.30.3/lib/perl5/5.30.3/XSLoader.pm line 114. -e syntax OK ``` It it nice XS::Parse::Sublike suppresses these warnings. An easy way to suppress these warnings seems to add "our" declaration: ``` diff --git lib/XS/Parse/Sublike.pm lib/XS/Parse/Sublike.pm index 620de28..7b16d26 100644 --- lib/XS/Parse/Sublike.pm +++ lib/XS/Parse/Sublike.pm @@ -10,6 +10,11 @@ use warnings; our $VERSION = '0.07'; +our $ABIVERSION; +our $PARSE; +our $REGISTER; +our $PARSEANY; + require XSLoader; XSLoader::load( __PACKAGE__, $VERSION ); ```
Hi, A better fix is actually just to use the `GV_ADDMULTI` flag instead of `GV_ADD`: === modified file 'lib/XS/Parse/Sublike.xs' --- old/lib/XS/Parse/Sublike.xs 2020-06-15 11:22:47 +0000 +++ new/lib/XS/Parse/Sublike.xs 2020-06-15 12:25:44 +0000 @@ -338,9 +338,9 @@ MODULE = XS::Parse::Sublike PACKAGE = XS::Parse::Sublike BOOT: - sv_setiv(get_sv("XS::Parse::Sublike::ABIVERSION", GV_ADD), XSPARSESUBLIKE_ABI_VERSION);- sv_setuv(get_sv("XS::Parse::Sublike::PARSE", GV_ADD), PTR2UV(&IMPL_xs_parse_sublike)); - sv_setuv(get_sv("XS::Parse::Sublike::REGISTER", GV_ADD), PTR2UV(&IMPL_register_xs_parse_sublike)); - sv_setuv(get_sv("XS::Parse::Sublike::PARSEANY", GV_ADD), PTR2UV(&IMPL_xs_parse_sublike_any)); + sv_setiv(get_sv("XS::Parse::Sublike::ABIVERSION", GV_ADDMULTI), XSPARSESUBLIKE_ABI_VERSION); + sv_setuv(get_sv("XS::Parse::Sublike::PARSE", GV_ADDMULTI), PTR2UV(&IMPL_xs_parse_sublike)); + sv_setuv(get_sv("XS::Parse::Sublike::REGISTER", GV_ADDMULTI), PTR2UV(&IMPL_register_xs_parse_sublike)); + sv_setuv(get_sv("XS::Parse::Sublike::PARSEANY", GV_ADDMULTI), PTR2UV(&IMPL_xs_parse_sublike_any)); wrap_keyword_plugin(&my_keyword_plugin, &next_keyword_plugin); That'll be in the next version -- Paul Evans