develooper Front page | perl.dbi.users | Postings from February 2001

Signal handlers in a DBI program

Thread Next
From:
McLennan,Neil [PYR]
Date:
February 14, 2001 08:46
Subject:
Signal handlers in a DBI program
Message ID:
26220CFFE5E5D4119AC500508B60D44236F3EC@ecvancouver.pyr.ec.gc.ca
I have to write a little Perl DBI server that listens to the end of an
Oracle Pipe for messages coming out of the database.  I have a skeleton of
this idea working but I am looking for a way of stopping this background
process from running. Using Signals seemed a fairly simple way of going.  My
test script looks like

use DBI;

$DB_SOURCE="dbi:Oracle:van1";
$DB_USER="neil";
$DB_PASSWD="tester";

$SIG(INT) = \&Finished;

# Connect
	$dbh->connect( $DB_SOURCE, $DB_USER, $DB_PASSWD);

	$sth=$db->prepare("BEGIN readpipe(?, ?); end;");
	$sth->bind_param_inout(1, \$first, 50);
	$sth->bind_param_inout(2, \&last, 50);

	while ( 1==1)
	{
		$sth->execute;
		print  "First:  ", $first, " Last:  ", $last, "\n";
	}
	
	
sub Finished
{
	print "Ending...";
	$dbh->disconnect;
	exit(0);
}



When I try to run this thing I get a compile error at the $SIG line which
would seem that %SIG is an unknown.  Is there a module I should be using?

Platform is Linux Redhat, Perl Version 5.005

Thanks in advance

Neil McLennan
Environment Canada
Vancouver BC



Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About