PEPPLER.ORG
Michael Peppler
Sybase Consulting
Menu
Home
Sybase on Linux
Install Guide for Sybase on Linux
General Sybase Resources
General Perl Resources
Freeware
Sybperl
Sybase::Simple
DBD::Sybase
BCP Tool
Bug Tracker
Mailing List Archive
Downloads Directory
FAQs
Sybase on Linux FAQ
Sybperl FAQ
Personal
Michael Peppler's resume

sybperl-l Archive

Up    Prev    Next    

From: Michael Peppler <mpeppler at mbay dot net>
Subject: Re: ct_callback
Date: Dec 29 1997 10:03PM

Ronald Page wrote:
> 
> I'm attempting to use CT_CALLBACK to register a callback routine for
> CS_CLIENTMSG_CB and CS_SERVERMSG_CB.  This is an attempt to get return
> code information for a failed trigger.  The problem is that my callback
> routines never get called.  Here are the statements I use (which
> apparently have no error):
> 
> $old_client_cb = ct_callback(CS_CLIENTMSG_CB, "clientCallback");
> $old_server_cb = ct_callback(CS_SERVERMSG_CB, "serverCallback");
> 
> I also have two subroutines named "clientCallback" and "serverCallback".
> The code in those subroutines is similar to the example in the SybPerl
> CTLib documentation.

This works fine for me with the server callback defined in ctutil.pl.
Maybe you have an error in the way the callback is coded.

I can also see an other potential problem. You are passing the
callback names as strings to ct_callback, instead of as references,
and it seems that ct_callback silently ignores the call if it
can't find the subroutine (by name), maybe because it was coded in
a different package.

You should probably code it this way:

$old_server_cb = ct_callback(CS_SERVERMSG_CB, \&serverCallback);

ie pass a reference to the sub to ct_callback instead of passing its
name.

Michael
--
Michael Peppler       -||-  Data Migrations Inc.
mpeppler@datamig.com  -||-  http://www.mbay.net/~mpeppler