in reply to error handling with dbi
use a file or put it in the script and define which database for each password.
Connect to each individually.
env.ini
A simple parser for .iniCARDTESTSID = CARD1 CARDTESTSVER = card1 CARDTESTUSER = pass CARDTESTPASS = pass CARDTESTPRT = 1521 CARDSID = CARD2 CARDSVER = card2 CARDUSER = pass CARDPASS = pass CARDPRT = 1521 PRISMTESTSID = JET1 PRISMTESTSVER = jet1 PRISMTESTUSER = pass PRISMTESTPASS = pass PRISMTESTPRT = 1522 PRISMSID = JET2 PRISMSVER = jet2 PRISMUSER = pass PRISMPASS = pass PRISMPRT = 1522
sub getEnv { my $file = shift(@_); unless (-f $file) { print "Could not find $file.\n"; exit(1); } open (FILE, "< $file"); while (<FILE>) { chomp; next if /^\s*\#/; next unless /=/; my ($key, $variable) = split(/=/,$_,2); $variable =~ s/\s+//g; $key =~ s/\s+//g; $ref->{config}->{$key} = $variable; } close FILE; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: error handling with dbi
by gandolf989 (Scribe) on Feb 16, 2016 at 16:33 UTC |