Subject: | Load-order issue with SOAP::Constants |
Date: | Fri, 01 May 2015 17:51:42 +0000 |
To: | "bug-SOAP-Lite [...] rt.cpan.org" <bug-SOAP-Lite [...] rt.cpan.org> |
From: | Aran Deltac <bluefeet [...] gmail.com> |
This fails:
perl -e 'use SOAP::Constants'
Use of uninitialized value $SOAP::Constants::WRONG_VERSION in concatenation
(.) or string at /usr/local/share/perl/5.14.2/SOAP/Lite.pm line 3531.
This passes:
perl -e 'use SOAP::Lite; use SOAP::Constants'
There is a load-order issue somewhere in here. I found this because @work
we preload modules alphabetically before forking processes and
SOAP::Constants comes before SOAP::Lite alphabetically.
Often the cause of load order issues is a simple circular dependency where
module A depends on module B and module B depends on module A (A <-> B). A
common fix would be to break out the dependent functionality into separate
modules so that you have:
A -> C <- B
Where C is a new module that contians code from A and B which breaks the
circular dependency. That doesn't always fix it logically, but some
derivative of that pattern works in most cases.