diff --git a/lib/Simba/CA.pm b/lib/Simba/CA.pm index 4c2682b..55b69ac 100644 --- a/lib/Simba/CA.pm +++ b/lib/Simba/CA.pm @@ -30,6 +30,26 @@ sub new { $self->{unknown_gid} = 65533; $self->{fh_log} = exists($opt->{fh_log}) ? $opt->{fh_log} : \*STDERR; $self->{log_level} = 99; + if ($opt->{dbi}) { + $self->{dbh} = DBI->connect(@{ $opt->{dbi} }, + { AutoCommit => 0, + PrintError => 1, + RaiseError => 1 + } + ); + } elsif ($opt->{dbi_file}) { + my $fn = $opt->{dbi_file}; + open(FN, "<$fn") or die "cannot open $fn: $!"; + my $line = ; + close(FN); + my @cred = split(/[\s\n]+/, $line); + $self->{dbh} = DBI->connect(@cred, + { AutoCommit => 0, + PrintError => 1, + RaiseError => 1 + } + ); + } return $self; }