I am trying to prevent generic crashes going to the browser in my
CGI program. I am using :
use CGI::Carp 'fatalsToBrowser';
and eventually I will use a set_message. However I have a
strange problem in that the following subroutine, if there are
errors on the statement execution, it does not send the error to
the browser. I can put my own 'die' in there and it works.
I am forced to use the 'eval' statement, as you can see on the
first SQL statement.
Would be grateful for any guidance.
Gary
sub add_record {
(code snipped here and there for brevity).
### Subject ###
if($add_subject) {
my $sql = <<SQL1;
INSERT INTO valid_subjects
values('$login','$subject',NULL)
SQL1
# Execute the SQL statement.
$sth = $dbh->prepare($sql) or die "preparing: ",$dbh->errstr;
eval { $sth->execute };
if ($@) { &failure($co); }
}
### From address ###
if($add_from_addr) {
my $sql = <<SQL2;
INSERT INTO valid_senders
values('$login','$fromaddress',NULL)
SQL2
# Execute the SQL statement.
$sth = $dbh->prepare($sql) or die "preparing: ",$dbh->errstr;
$sth->execute or die (&failure($co));
}
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]