in reply to Database Connections
It might even be clearer to future maintainers of your code if you used 'get' instead of 'new'.package DBHandle; use DBI; my $dbh; sub new { $dbh ||= DBI->connect(...) or die "..."; return $dbh; } # and everywhere you need it: my $dbh = new DBHandle;
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Re: Database Connections
by ichimunki (Priest) on Jan 15, 2001 at 19:51 UTC | |
Re: Re: Database Connections
by Anonymous Monk on Jan 15, 2001 at 20:04 UTC | |
by Fastolfe (Vicar) on Jan 15, 2001 at 20:19 UTC | |
by chipmunk (Parson) on Jan 15, 2001 at 20:23 UTC |