Subject: | [patch] Use of uninitialized value $ns in string eq at XML::Compile::Cache |
Hello!
First of all, let me just say a big **THANK YOU** for all the XML::Compile suite. It has consistently solved a lot of problems and saved me a lot of time over the years!
The reason for this ticket is that, while I was using it to implement a SOAP interface to the Brazilian postal service, I found myself triggering "uninitialized" warnings all over the place.
I fixed it by changing line 87 of XML/Compile/SOAP11/Operation.pm like so:
-----------8<-----------
- my $rpc_ns = $body->{namespace};
+ my $rpc_ns = (defined $body->{namespace} ? $body->{namespace} : '');
----------->8-----------
If you feel I fixed the wrong part of the code or broke something else (which is entirely possible, though all the current test suite still passes with this patch), or if I just plain screwed up and forgot to set X or Y properly, the code below reproduces the warnings I'm seeing and might help diagnose the issue better:
-----------8<-----------
use strict;
use warnings;
use XML::Compile::WSDL11;
use XML::Compile::SOAP11;
use XML::Compile::Transport::SOAPHTTP;
use HTTP::Tiny;
my $wsdl = XML::Compile::WSDL11->new(
HTTP::Tiny->new->get('https://apphom.correios.com.br/SigepMasterJPA/AtendeClienteService/AtendeCliente?wsdl')->{content}
);
my $call = $wsdl->compileClient('buscaCliente');
----------->8-----------
This is what I see when I run it:
$ perl xml_compile.pl
Use of uninitialized value $ns in hash element at /Users/garu/.plenv/versions/5.20.1/lib/perl5/site_perl/5.20.1/XML/Compile/Cache.pm line 125.
Use of uninitialized value $ns in hash element at /Users/garu/.plenv/versions/5.20.1/lib/perl5/site_perl/5.20.1/XML/Compile/Cache.pm line 134.
Use of uninitialized value $ns in concatenation (.) or string at /Users/garu/.plenv/versions/5.20.1/lib/perl5/site_perl/5.20.1/XML/Compile/Cache.pm line 135.
Use of uninitialized value in string eq at /Users/garu/.plenv/versions/5.20.1/lib/perl5/site_perl/5.20.1/XML/Compile/Cache.pm line 166.
Use of uninitialized value $ns in string eq at /Users/garu/.plenv/versions/5.20.1/lib/perl5/site_perl/5.20.1/XML/Compile/Cache.pm line 166.
Thank you very much for you time, and for the entire XML::Compile suite!
Cheers,
garu