use strict;

andrew at work agray at
Sun Nov 9 17:27:37 CST 2003

All, I have been trying to write some nice perl code, which has some reusable library subroutines in a ./lib dir.
It involves opening and closing a database connection and updating some info. I have not worked with databases before so maybe there is a better way to do this.

In order to avoid opening and closing the DB connection to often I have let the parent routine open the DB connection and let the subroutines assume it is already open when they are called. (Have had some bad experiences with web pages that open and close DB's way too many times and cause really excessive load). 

As the subroutines are in a seperate lib file being called by require "./lib/" the $dbc variable cannot be seen by the routine if strict is used, but is fine if strict is not used. This is needed as there are a number of different scripts calling the common subroutines.

Is there a way to define global variables and keep using strict? Have I missed something else ?

-------------- next part --------------
An HTML attachment was scrubbed...

More information about the Melbourne-pm mailing list