Inherit with 'use parent' instead of 'use base' #78
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
With #30, the way LWP::Protocol::https and LWP::Protocol::https::Socket have their parents defined changed from using the
@ISA
list touse base
. However,use base
apart from defining the parent(s) of packages also tries loading the classes in question. When using SOAP::Lite and LWP::Protocol::https as an implementor for LWP::Protocol, trying to send an HTTPS request leads to a failure, and the IO::Socket::SSL::SSL_ERROR scalar which technically is meant to contain SSL failure messages contains the following error instead:Can't locate object method "new" via package "LWP::Protocol::https::Socket" at SOAP/Client.pm
. The final error is the following:I am using a custom perl + modules distribution, but I have the latest LWP::Protocol::http in
@INC
and there is no way it doesn't contain the LWP::Protocol::http::SocketMethods package.This is an excerpt from the code that performs the SOAP::Lite requests (I did my best to keep the code as runnable as possible while getting rid of custom things):
My/Custom/SOAP/Schema.pm:
driver script:
Apart from resolving SOAP::Lite failures for people that have code similar to mine (I'm not sure if there are many because #30 is 7 years old), this change also has the following benefits:
use base
is technically a backwards incompatible change for LWP::Protocol::https::Socket, previously its parent was never loaded unless needed withour @ISA
and this restores the backwards compatibility;I've been testing this over the course of a month and it seems fairly stable. Feel free to share feedback as well.