Lynn, Steve wrote:
> All - I'm under Solaris using perl v. 5.8.3 and DBI v. 1.48.  I can catch 
> signals w/o a problem before I connect to the database.
> 
> However after I connect, I can't catch signals anymore.  If I comment out the 
> "DBI->connect" and press ctrl-c in a ReadLine(0), the signal is caught fine.
> 
> 
> 
> I found one other issue that seemed similar 
> (http://www.mail-archive.com/dbi-users@perl.org/msg07747.html).
> 
> 
> 
> Please help.
> 
> 
> 
> ###########################
> 
> 
> 
> #!/usr/local/perl -w
> 
> 
> 
> use strict;
> 
> use warnings;
> 
> use Term:ReadKey;
> 
> require DBI;
> 
> 
> 
> use sigtrap 'handler', \&SigExit, qw/HUP INT KILL/;
> 
> 
> 
> my $dbh;
> 
> my $response;
> 
> 
> 
> sub SigExit {
> 
>     print STDOUT "\nTest\n";
> 
>     die("\n");
> 
> }
> 
> 
> 
> $dbh = 
> DBI->connect("DBI:Oracle:host=dbserver;sid=mydb;port=1521","scott","tiger");
> 
> 
> 
> print "\nEnter a response: ";
> 
> $response = ReadLine(0);
> 
> 
> 
> print ""\nEnter another response: ";
> 
> $response = ReadLine(0);
> 
> 
> 
> ###########################
> 
> 
> 
> Thanks,
> 
> Steve
> 
> 

Oracle client libraries can trap some signals (including HUP) depending
on which ones you use and how you are connecting. I believe you will
need to set up your handlers after connect for those signals but I
cannot remember the down side in Oracle.

There have been various posts on dbi-users about this in the past so an
archive of dbi-users (some can be found at dbi.perl.org) would probably
list them.

Martin
-- 
Martin J. Evans
Easysoft Limited
http://www.easysoft.com

Reply via email to