in reply to Re: Ssh Keys
in thread Ssh Keys

Ah neat! thanks for your help. Can i ask why global vars are "bad mojo"?

Replies are listed 'Best First'.
Re^3: Ssh Keys
by talexb (Chancellor) on Nov 28, 2005 at 22:45 UTC

    Globals are bad in just about any programming language because it's so easy to tinker with the value wherever you are in the code. The flipside of that is, when Something Bad happens in the code, you have no idea where that global is being changed.

    A better coding style involves limiting a variable to the smallest possible scope, like within a small piece of code, such as within an object definition, where you can control the setters and getters of the object's attributes.

    And if you need a rule, it's probably something like "Global variables should be the exceptions, not the rule".

    Alex / talexb / Toronto

    "Groklaw is the open-source mentality applied to legal research" ~ Linus Torvalds