in reply to Passing a database connection

I also had similar problem (needed to pass DBH around).

The other thing you might want to look for is Singleton design pattern.

By using it, you could connect just once in your program (on first need to do so) and every other call to function/method (get_instance or similar is prefered) would just give you your old DBH (instance of object that would contain your DBH to be precise) - no need to pass DBH around.

You could check out Class::Singleton on CPAN. I also imagine lot's of DB abstraction modules use this ...


Have you tried freelancing? Check out Scriptlance - I work there.