in reply to Obscure variable suicide problem in autoloaded module

Looks like you've stumbled on one of the many, many problems that occurs when using global variables. Since these variables do not need to be declared, it's relatively easy to misuse them. I don't think it's possible to tell, from the information you've listed, exactly what the problem is, but here are some guesses:

As a general rule, if I find that I'm worrying a lot about namespace issues, then I have some serious code problems and need to consider redesigning things, though I realize that you may not have this luxury. Good luck! Sounds like you've got a serious problem on your hands.

Cheers,
Ovid

Vote for paco!

Join the Perlmonks Setiathome Group or just click on the the link and check out our stats.

Replies are listed 'Best First'.
Re: (Ovid) Re: Obscure variable suicide problem in autoloaded module
by HyperZonk (Friar) on Jul 13, 2001 at 00:41 UTC
    Some notes -- I seem not to have been very clear in my original message (looking back at it, indeed, very muddy).

    First of all, EmailQuote and QuotePage neither refer to $QtePostscript. That variable is only referenced in that module by genHTMLQuote.

    No, it is not a strictish program. And, yes, globals are overused - this was a down and dirty script that needed to be completed in a very short time. (Excuses, excuses, may the Saints forgive me!) However, this program does work "flat" and does not work as autoloaded modules (the script was tested without autoload, BTW, to ensure no deferred run-time errors). Also, literally the only places in the code in which $QtePostscript appears is at its initialization in main:: and at genHTMLQuote in the WQ_Finish module (I searched the code, both flat and modulized).

    Thank you for your tips, of course. Fortunately, I will have an opportunity to take a lot of time to fix this messy script sometime in the near future, and your tips will be invaluable.