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;
In reply to Re: Database Connections
by Fastolfe
in thread Database Connections
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |