A few days ago I started writing apps using Mason. For some reason the following code;
does not trigger the abort, finding this a bit strange, I then ran the following under mod_perlmy $sql = "this is not sql" ; my $sth = $dbh->prepare($sql) or $m->abort(500) ;
use DBI ; my $r = Apache->request; $r->content_type("text/html"); $r->send_http_header(); $dbh = DBI->connect('dbi:mysql:test:localhost', 'user', 'pass' ); my $sql = "blah blah blah" ; my $sth = $dbh->prepare($sql) or die('sql prepare error'); $sth->execute() ; my ($name) = $sth->fetchrow_array; $r->print( ".$name.\n") ;
In both cases the DBD::mysql::st error is written to the error log, but not the die error from my program. To try and prevent myself from going mad, I did the exact same thing using traditional cgi and still no die() error. Even if the script is executed from the command line it still doesn't die!!
Shouldn't prepare return a undefined reference on error, forcing the die to be executed?
If it helps, I'm running Debian Woody, with Perl 5.6.1 and DBI 1.31
In reply to $dbh->prepare not triggering die by Nomis52
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |