All - I'm under Win2k with ActiveState binary 629, DBD-MySQL 1.22, and DBI
1.14. I can catch signals w/o a problem before I connect to the database.
However after I connect and immediately disconnect, I can't catch signals
anymore.
I know that signals aren't 100% supported under Windows. However, I'm not
trying to do anything too difficult, just catch a CTRL-C from the keyboard.
I'm just wondering why it works fine if my connect/disconnect statements are
commented out.
Anyone have any ideas?
Thanks for the help,
Mark
###########################
#!perl -w
use strict;
use diagnostics;
use DBI;
my $quit = 0;
use sigtrap qw(handler my_handler normal-signals error-signals);
while ($quit == 0) {
print "in while()\n";
# Comment out the next two lines and it works fine.
my $result = query_db();
print $result;
my $i = 0;
for ($i = 0; $i < 2; $i++) {
sleep (1);
print ". ";
}
}
sub query_db {
# Build the database connection string.
my $dbstring = "DBI:mysql:database01:127.0.0.1:3306";
# Connect to the database.
my $dbh = DBI->connect($dbstring,"user","password")
or die "Can't connect to mysql on 127.0.0.1: $DBI::errstr\n";
# Assume result from the db is named result.
my $result = "Test";
print "Disconnecting \$dbh\n";
$dbh->disconnect()
or warn "Disconnection failed: $DBI::errstr\n";
return ($result);
}
sub my_handler {
print "Caught the CTRL-C\n";
++$quit;
}
--
Mark Riehl
Agile Communications, Inc.
Email: [EMAIL PROTECTED]