logo
Author: ksurent
Description:
Language: Perl
package DBH;

use DBI;

use base Exporter;
our @ISA = qw(Exporter);
our @EXPORT = qw(dbh);

# load auth data from config
# or explicitly defined here

my $dbh;

sub dbh {
  unless(defined $dbh) {
    $dbh = DBI->connect(...)
  }

  $dbh
}

END {
  $dbh->disconnect if defined $dbh
}

1
Recent pastes:
blessmaster (PHP)
antonivanov (SQL)
antonivanov (PHP)
brinza (PHP)
ilyhamas (Delphi)
Riateche (PHP)
otherlight (Java)
otherlight (JavaScript)
otherlight (CSS)
otherlight (CSS)
biophreak (JavaScript)
n4n (Perl)
prostoHz (Java)
ndubinkin (XML)
Riateche (Plain Text)
Slapotam (Perl)
ksurent (Perl)
John_Wein (Java)
John_Wein (HTML)
Riateche (HTML)
netsago.paste.β © 2009 Neunica