in reply to Re^2: error for undefined function that's been imported
in thread error for undefined function that's been imported
I'm replying to my own posting to provide an update with a new observation. In my attempts to understand rinceWind's description of how use/import works by playing with the order of which packages are imported with use (and getting absolutely nowhere), I decided to re-order the use statements in the actual perl program itself--not in the modules. To my surprise (because I don't understand it), the problem magically went away. Yes, by merely swapping which package was included first, the error evaporated:
use MyUserProfile "ProfileGet"; use Register qw(PrintTemplate);
This works. Swap the two, and I get the undefined function error for MyUserProfile.pm. Problem is, this "solution" only happens to work with this perl script. I can write another that merely makes different calls to some other functions in these packages, and I'll get another "undefined function" error... which, again, can be fixed by--sigh--swapping the use statements in that perl script.
So, what I'm left with is a complete misunderstanding of how to generally avoid such a problem with any given perl script that imports these (and many other) packages (that I write). I've got a ton of routines in each package that all call routines into each other. I don't mind following the rules about order and precedence, but I either don't know what they are (I thought I did), or the speghetti just gets too tangled when module sizes (and quantities of them that use each other) exceeds a certain threshold.
|
|---|