in reply to Global variable vs passing variable from sub to sub
That said, selective usage of global variables can often be a big benefit to a program's maintainability. For example, most session implementations in web applications are glorified global variables. Using a sessionstore can significantly reduce the amount of tramp data that goes on the URL.
Often, specific variables are maintained globally, such as $dbh. With proper documentation, I don't see a problem with this. I would (and do) prefer using a singleton instead of an explicit global, just so that new usages can be easily added. But, styles differ.
------
We are the carpenters and bricklayers of the Information Age.
Then there are Damian modules.... *sigh* ... that's not about being less-lazy -- that's about being on some really good drugs -- you know, there is no spoon. - flyingmoose
I shouldn't have to say this, but any code, unless otherwise stated, is untested
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Global variable vs passing variable from sub to sub
by kiat (Vicar) on Sep 13, 2004 at 16:45 UTC |