Ravi Malghan wrote: > Hi: I connect to a database within my script. If the script cannot connect, I > want it to send an email and terminate without printing any message on > stdout. I have the following code $dbh = > DBI->connect("dbi:Pg:dbname=$dbname;host=$host;port=$port;","$username", > "$password", {AutoCommit => 1}) or die notifyError($message, $subject); > > When I run the script, it does call the notifyError function fine and I > receive the email. But it spits out the following message. Any way I can > terminate without putting any message on the screen? -bash-3.00$ > processRemedySubmit.pl DBI > connect('dbname=data;host=hostA;port=5435;','postgres',...) failed: could not > translate host name "hostA" to address: node name or service name not known > at ./scripts/processRemedySubmit.pl line 32 Died at > ./scripts/processRemedySubmit.pl line 32.
Like this. (Note also that you shouldn't put double quotes around the scalar variables.) HTH, Rob $dbh = DBI->connect("dbi:Pg:dbname=$dbname;host=$host;port=$port;", $username, $password, {AutoCommit => 1, PrintError => 0}); unless ($dbh) { notifyError($message, $subject); exit; } -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/