> entered into the database.  With this code, I recieve the Carp error in
the
> browser.  When I turn off Carp, the script acts as if the entry was added
> (no error displayed), but the record is not entered.  Can anyone offer
> suggestions on how to make decisions based on a DBI error message ?

wrap your $dbh->do() in an eval block:

eval {
 $dbh->do( ... insert statement ... );
};
if ($@ =~ /constraint violation/) # or whatever the error message is
{
  return &duplicate_email();
}
elsif ($@) # some other error occurred
{
  die $@;
}
# insert succeeded...


Please note that:
 
1. This e-mail may constitute privileged information. If you are not the intended 
recipient, you have received this confidential email and any attachments transmitted 
with it in error and you must not disclose, copy, circulate or in any other way use or 
rely on this information.
2. E-mails to and from the company are monitored for operational reasons and in 
accordance with lawful business practices.
3. The contents of this email are those of the individual and do not necessarily 
represent the views of the company.
4. The company does not conclude contracts by email and all negotiations are subject 
to contract.
5. The company accepts no responsibility once an e-mail and any attachments is sent.

http://www.activis.com




This annotation was added by the e-scan service.
http://www.activis.com
----------------------------------------------------------------------------------
This message has been checked for all known viruses by e:)scan.
For further information please contact [EMAIL PROTECTED]

Reply via email to