ric00015 has asked for the wisdom of the Perl Monks concerning the following question:
This is a continuation of a previous node, found here. I am making a new node, rather than continuing the old one, to clarify and simplify. If you haven't read that one, please do; this node might make more sense once you do.
My problem stems from the fact that I recently did a mass upgrade on my CPAN, and subsequently broke something that seems to be important to exporting module functions or loading incomplete modules.
In my other nodes, I talked about my program for work. Here's a basic structure for it. Let's call the main script main.pl, with an explicit package of main. I have several modules: CG::GUI.pm, which holds Tk code, CG::CORE2.pm, which holds most of the logic, and Paths.pm, which was written by a coworker. In main.pl, I use CG::GUI and CG::CORE2. In CG::CORE2 I use Paths and other modules. But Paths is the one I'm having problems with. I have to use lib '/abs/path/to/module'; for each module for specific reasons, which may not be important now. The specific error I am getting, when I run main.pl, is:
Undefined subroutine &Paths::get_config called at /abs/path/to/CG/CORE2.pm line 128, <FILE> line 30.Line 128 in CG::CORE2 is:
%config = %{Paths::get_config($var1, $var2)};This is just with a use Paths; statement. When I put a require '/abs/path/to/Paths.pm';, I get 9 warnings such as:
Subroutine sub1 redefined at /abs/path/to/Paths.pm line 68.(use diagnostics; doesn't help much; it only says how to disable the warnings)
9 subroutines are being redefined, which means Paths.pm is being loaded with only 9 subroutines. However, there are 15 subroutines being exported, and more that aren't. The specific subroutine mentioned above in line 128 is not among the exported.
So the question has gone from "What did I do and how do I fix it?" to "What could possibly cause a module to partially load?" For the sake of completeness, I installed other versions of Perl. The one that got updated and borked was 5.16.0. I installed a fresh instance of the same version, plus 5.18.1. (System Perl is completely separate.) All had the same errors/warnings (with the trivial exception listed in the previous node. I will not go into detail here).
This indicates, to me at least, 2 possibilities. 1) that a common file/setting/env variable was corrupted. This would suck, because I have no idea what all 3 Perls would use. They are all installed separately; they all have their own CPAN/modules; they should all be independent, especially if the script explicitly states which Perl to use.
Or 2) a module that was updated broke something, and the recently installed Perls also have that module. This also sucks, because I have no idea which CPAN module I need to look for. Once I have the (hopefully small) list of modules, I can see which Perl has which version of the modules.
tl;dr: One of my modules doesn't contain all the subroutine it is supposed to at run-time. It's either an export issue, or just an incomplete load. Or something totally different. I don't know yet.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Module not loading completely? Part 2
by Corion (Patriarch) on Oct 30, 2013 at 20:33 UTC | |
by ric00015 (Beadle) on Oct 30, 2013 at 21:43 UTC | |
by Anonymous Monk on Oct 30, 2013 at 22:44 UTC | |
|
Re: Module not loading completely? Part 2
by MidLifeXis (Monsignor) on Oct 30, 2013 at 20:16 UTC |