On Tue, Dec 2, 2008 at 2:19 PM, Hendrik Schumacher <[EMAIL PROTECTED]> wrote:
> alarm() definitely works in mod_perl.
Then I wonder why my test code is successfully interrupting the
DBI->connect method from the command line, but not when running in
modperl 1.3 (the versions of perl are the same).
sub handler {
...
eval {
my $h = set_sig_handler('ALRM',sub {die "DBD took longer than
$MYSQL_ALARM_LIMIT seconds to do its MySQL work\n"});
alarm($MYSQL_ALARM_LIMIT);
my $dbh = DBI->connect($datasource,'','', {PrintError => 0});
if (!$dbh) {
warn $DBI::errstr;
} else {
my $data = rand();
my $sh2 = $dbh->prepare("select * from test where data = $data ");
$sh2->execute;
my @result = $sh2->fetchrow_array;
warn "Result fetched: @result\n";
}
};
alarm(0);
...