Subject: | 'uninitialized value' warning when calling setNamespace passing undef value returned from namespaceURI |
I'm in the process of updating our perl build (perl 5.8.8 => 5.20; XML::LibXML 1.66 => XML-LibXML-2.0126). Using the newer versions, the attached code 'get_set_namespace' produces a new 'uninitialized value' warning.
After some debugging and doing a little research, I think the problem is here:
XML-LibXML/perl-libxml-mm.c
1204c1204
< if ( scalar != NULL && scalar != &PL_sv_undef ) {
---
Show quoted text
> if ( scalar != NULL && SvOK(scalar) ) {
Basically, in the previous versions, the 'undef' being passed in happens to be the same 'undef' as &PL_sv_undef and is handled without a 'uninitialized value' warning. That appears to no longer be the case.
From http://perldoc.perl.org/5.20.2/perlguts.html:
"So to repeat always use SvOK() to check whether an sv is defined."
Note: I think I've properly connected the dots here, but I've just started poking around in the Perl XS stuff, so I could be way off base.
Subject: | get_set_namespace |
Message body not shown because it is not plain text.