http://qs321.pair.com?node_id=11130129


in reply to Re: How to import "global" variables into sub-scripts from main script?
in thread How to import "global" variables into sub-scripts from main script?

Just don't be surprised later when everything breaks and no one wants to touch the monster.

Whether it breaks or not, or even if I wrote it with the combined impeccable abilities of all you experts here, when I'm no longer able to maintain it, it is highly unlikely that anyone else will; not because they wouldn't want to, but because they don't know the first thing about programming, much less Perl. I honestly do not personally know another Perl programmer. I have never met one in my entire sojourn in this part of the world. My Perl books come from Amazon--from America; I don't recollect seeing any such in bookstores in my area. Perl may be a well-established fact in some parts, but not where I am. Here, people learn Java, or C++, or .NET, etc.

Your "horrible" possibility looks too scary for me. I don't dare try it.

Because I have never been able to grasp abstractions like OO, references, etc., I've never seen modules as an option for me. I can only do what I have ability for. If I don't understand something, even copy/pasting from someone else will almost never work for me, as I'm unable to adapt to my needs that which I do not understand in the first place. So I generally do all of my own programming, simple though it may be. For some blessed reason I do usually understand regex quite well--I guess it's not so abstract.

After a few minutes without strict I was able to find the troublespot and everything is working well again. Strict is still in use in my main script file, as it always was. It causes no problems there, but it throws a fit if brought into any of the sub-files.

...ACTUALLY, I just confirmed that redeclaring the globals in the sub-script still allows their values to pass from the main script, and that "strict" seems satisfied with that. Honestly, it smacks of overkill to me to have to declare variables repeatedly--if I were to add "strict" to my other files, the globals would have to be repeated in each of them too (I started with just the main MYSQL sub-script). AND, after adding all those global variables, strict had nothing at all to say--that was the only thing between the script running or not running. It was no idle "warning." It was a "kill script" level error to simply not have redeclared my global variables. I don't find this behavior helpful. I know, I'll probably get a ton of downvotes for speaking my mind, as I have with my other posts here, but I have never been a conformist for the sake of popularity. Now, if "strict" had actually said anything useful to me after I had gotten past the globals issue, i.e. if it had told me something about my code that had earlier escaped my notice, and that was an important weakness, I might have a different view. But, nope. It was just its own rigidity. Everything would have worked fine without it.

Blessings,

~Polyglot~