in reply to Capturing SQL errors in Perl
As moritz suggested, using exceptions can simplify your logic:
Also, please use placeholders!$dbh->{RaiseError} = 1; # only need to do this once ... eval { my $sth = $dbh->prepare(...); $sth->execute(...); }; if ($@) { # unable to insert, error message is in $@ ... }
|
|---|