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: mpeppler at itf1 dot itf dot ch (Michael Peppler)
Subject: Re: Trapping low-level Sybase errs
Date: Mar 14 1996 1:15PM

> From: Michael Sattler 

[...deleted ...]
> 
> ::::::::::::::::::::
> ::   support.pm   ::
> ::::::::::::::::::::
> 
> #!/usr/local/bin/perl

That's not necessary (I guess it doesn't hurt, though...)

> 
> #---------------------------------------------------------------------
> # Set up the external packages we use.
> #---------------------------------------------------------------------
> sub main'setUpExternalPackages{
> 
> ...
> 
>     #------------------------------------------------------------------
>     # Sybperl
>     #------------------------------------------------------------------
>     require 'sybperl.pl';               # ensure sybperl is here
>     use Sybase::DBlib;                  # activate the class

Oops!

You don't want to require sybperl.pl (which does a 'use Sybase::Sybperl'
which in turn does a 'use Syabse::DBlib') if you're going to use the
Sybase::DBlib module...

>     dbmsghandle (\&message_handler) ;   # trap all errors
> 
>     $d = new Sybase::DBlib $dbUser, $dbPassword, $dbServer ;
> }
> 
> # ---------------------------------------------------------------------
> # INPUT:
> #   level   - at which debug levels to emit this string
> #   string  - the debug string to be emitted
> #
> # OUT:
> #   The text passed in, printed...
> # ---------------------------------------------------------------------
> sub main'debug {

You should probably use the ::  syntax (main::debug) instead (the
main'debug) form is deprecated).


> # ---------------------------------------------------------------------
> # Deal with Sybase error states not returned by the execution of the
> # SQL statement.
> # ---------------------------------------------------------------------
> sub main'message_handler {

[deleted for brevity] but looks OK to me...

> # ---------------------------------------------------------------------
> return(1) ;                             # I have to do this !?!

Yes:  all modules/files that you 'use' or 'require' have to end with a TRUE
value.

Michael