On Tue, 23 May 2000, Marc Lehmann wrote: > At leats in the example I sent in there is no sign of any closure. There is a closure, and this might be the thing that's making trouble for you, or at least part of it. This is a closure: > package othermodule; > my $global = 5; > > sub set_global { > $global = shift; > } That will cause &set_global to keep a copy of $global after it goes out of scope for the rest of the package. > Indeed, I could have worded it better. Just replace global by > "file-scope" and it is correct, though. What I wanted to make clear is > that the my variable in question is global (= life during the program > lifetime), since it was declared at package scope. A lexical (my) variable normally goes away when perl leaves the scope it was declared in. Only your closure kept it around. > Huh? Why is "do" a bad thing???? Do is bad because it is called every time, even if you've already executed the code, unlike require which checks %INC. It also makes you check $@ to see if the code compiled, unlike require. It's usually used for nasty perl4-ish stuff without packages. In your case, you're setting your own flag to keep from compiling again and checking $@ yourself, so you're getting around these problems, but the file form of do is generally a red flag. - Perrin
- Re: global variables and reparsing question (low prior... Gunther Birznieks
- Re: global variables and reparsing question (low ... Marc Lehmann
- Re: global variables and reparsing question (low prior... Autarch
- Re: global variables and reparsing question (low ... Marc Lehmann
- Re: global variables and reparsing question (... Matt Sergeant
- Re: global variables and reparsing questi... Marc Lehmann
- Re: global variables and reparsing question (... Daniel Jacobowitz
- unsubscribe instructions Fabio Arciniegas A.
- Re: global variables and reparsing question (low prior... Perrin Harkins
- Re: global variables and reparsing question (low ... Marc Lehmann
- Re: global variables and reparsing question (... Perrin Harkins
- Re: global variables and reparsing questi... Doug MacEachern
- Re: global variables and reparsing questi... Marc Lehmann
- Re: global variables and reparsing qu... Ken Williams
- Re: global variables and reparsing question (low ... Marc Lehmann
- Re: global variables and reparsing question (low prior... Ken Williams
- global variables and reparsing (short reproducible exa... Marc Lehmann
- Re: global variables and reparsing (short reprodu... Doug MacEachern
- Re: global variables and reparsing (short rep... Marc Lehmann
- Re: global variables and reparsing (short... Stas Bekman
- Re: global variables and reparsing (s... Marc Lehmann