|Perl Monk, Perl Meditation|
|( #3333=superdoc: print w/replies, xml )||Need Help??|
Well, after hours of attempting everything, including changes to ALL of my scripts with attempts at using "do" per the suggestion made here: Re: Exporting all variables and subroutines using Exporter, attempts at using 'require' for a .pl file, or using 'use' for a package (.pm) file that was setup in package format and exporting ALL of the variables (a rather long list, but apparently there is not simple way to export everything without listing them all individually--so everything was repeated, manually); I have come to the point that I believe this solution does not work. At least, not while using strict. Once again, strict is uselessly a monkey wrench in the works, stopping the script at compile time when it hadn't even had a chance yet to find the variable declarations. This is a problem. I was declaring the variables within the module/file that I was then referencing within the script--at the top of it, too--yet the compiler does not traverse the modules in time to prevent compile-time errors by strict.
I have to ask--did you REALLY get this to work just as you have prescribed above in your own code?
Whether or not you did, it doesn't work for me, and I'm left with looking at options for combining everything into one single file again. AARGH! Why does Perl have to be such a pain! Okay. I can just avoid the strict pragma. But then strict is shooting itself in the foot to tell me about problems that don't actually exist before it even has a chance to discover the fact. Basically it shuts down compilation before finding the variable declarations that it's saying do not exist--when they do exist in the package.
I don't think 'strict' was designed to work on a multi-file perl script. I have yet to find a way to keep it happy without declaring every global variable in every single file of the script. My current "GlobalVars.pm" package contains around 450 lines of code. I'm not eager to repeat that 18 times, totally redundantly, in every single file of the script when those should be GLOBAL to begin with and not have to be REDECLARED every single time they get used AGAIN. I guess my mind is illogical, but to declare something means it did not previously exist--so I should not have to declare again things which have already been declared as globals.
In reply to Re^2: How to import "global" variables into sub-scripts from main script?