Subject: | Subroutine _call redefined at (eval ...) during second SOAP::Lite->new() |
When I run SOAP::Lite->new() with the same service URL more than once, I get bunch of warnings:
Subroutine xxx redefined at (eval xxx) line 145.
A simple test script attached.
Apparently SOAP::Lite tries to compile both WSDLs to the same package. This can be a problem - for example, if I want to have two SOAP::Lite objects with different settings (proxy, etc.) but the same service URL, or if I want to have a long-running process and the contents of the same URL can change between the SOAP::Lite->new() calls, etc.
A quick but insufficient fix is to disable the "Subroutine redefined" warnings (patch attached). The proper fix would be to use a separate namespace prefix for each ->new() call. For example, in my test script, I may want to continue using $first with the old service description and $second with the new one, but I think current SOAP::Lite simply overwrites the shared package with the new version, should the contents of the URL change.
Subject: | soap-lite-redefine.patch |
--- SOAP/Lite.pm.orig 2014-11-21 17:56:25.564703445 +0100
+++ SOAP/Lite.pm 2014-11-21 17:56:01.742630557 +0100
@@ -3298,6 +3298,7 @@
eval "require $_" or Carp::croak "Could not load cached file: $@";
}
else {
+ no warnings 'redefine';
eval $self->generate_stub($_) or Carp::croak "Bad stub: $@";
}
}
Subject: | soap_lite_test.pl |
#!/usr/bin/perl -w
use strict;
use lib '.';
use SOAP::Lite;
my $first = SOAP::Lite->new(
service => 'https://github.com/xrosecky/JAVA_ISDS/raw/master/ISDSWebServices/src/main/resources/wsdl/dm_info.wsdl',
);
my $second = SOAP::Lite->new(
service => 'https://github.com/xrosecky/JAVA_ISDS/raw/master/ISDSWebServices/src/main/resources/wsdl/dm_info.wsdl',
);