in reply to Use globals or pass around everything under the sun?

Ok, repeat after me ...
"Global variables are bad"
"Global variables are bad"
"Global variables are bad"
"Read Code Complete by Steve McConnell"

As you can see I try to avoid global variables at all cost. If the number of variables your are passing to modules/functions is over 10. You need to take a look at what you're doing again and rethink it. Try to combine variables that are related and pass them as a hash.

Look at CGI::Application as a large framework for web applications. If its a stand alone program you can still get an idea as to how you can organize things.

You're not too clear as to what you're doing. But in any application if you're passing too many variables in to give it information, you're more likely to have problems. Both in tracking down where it is and how many crop up as well as how much time it takes to create it. Try to break the task down as much as you can. You'll find you can reuse code in a lot of places and save a lot of time.

The more you reduce the load on the database, the better your application will run. Though having 30 or more variables going to a module won't slow the application down, it just makes it more complicated. Just remember you have to keep track of all those variables.

Work on getting the job done first, then optimise it for speed.

BMaximus
  • Comment on Re: Use globals or pass around everything under the sun?