Re: Avoidinig globals

Tech-Archive recommends: Fix windows errors by optimizing your registry

From: Tim (al_at_gahnstrom.se)
Date: 03/08/05


Date: Tue, 08 Mar 2005 07:48:14 GMT

Mark Schupp wrote:
> Either don't use globals at all (as in following example) or use a naming
> convention for global variables like "g_var" so that you only use them
> intentionally in subroutines.

Both solutions are workable but none are really good I think.

But if there is not globals explicit kind of directive I guess they are
as good as they will be.

Thanks

Tim



Relevant Pages

  • Re: Reflectiong capabilityof Python
    ... clsName = "ClassA" ... aObj = createObjectByName ... if you are talking about creating an objcet dynamically and naming the ... Use the globals() dict which is handy when you know the class is ...
    (comp.lang.python)
  • Re: about the vars scope
    ... Under mod_perl,the situation is very different from common CGI environment,and the vars sharing sometimes is useful and needed. ... I hope I'm correct.If not,the criticism are welcome. ... I would use Exporter only to export subroutines, not variables because, as discussed, it is difficult to understand what is happening. ... I don't use mod_perl but my understanding it that it doesn't, or didn't, reset the globals to the default state. ...
    (perl.beginners)