|
|
sybperl-l Archive
Up Prev Next
From: "Vallon, Justin (Exchange)" <jvallon at bear dot com>
Subject: Bug: dbmsghandle(undef) vs. { $x = undef; dbmsghandle($x); }
Date: Mar 22 2001 7:04PM
Michael Peppler & SybPerl List,
I am trying to set and restore dbmsghandle and dberrhandle, but once they
have been set to something that is not undef, it cannot be reset to undef
via a variable, but it can be unset if "undef" is passed literally. My
work-around is to use dbmsghandle($new || undef) when setting with the
possibility of !defined($new).
Sample:
use Sybase::DBlib;
print "version $Sybase::DBlib::Version\n";
my $x = sub {};
my $y = undef;
my $z;
dbmsghandle($x);
$z = dbmsghandle($y); # Passing $y (undef) does not reset
to undef
($z == $x) || warn "expected $x, got $z";
$z = dbmsghandle(undef);
($z == $y) || warn "expected $y, got $z"; # Complains here
$z = dbmsghandle(undef);
($z == undef) || warn "expected undef, got $z";
Output:
version This is sybperl, version 2.10
Sybase::DBlib version 1.46 11/06/98
Copyright (c) 1991-1998 Michael Peppler
expected , got CODE(0x4007b624) at ./x.pl line 18.
If important, Perl version 5.005_03 for PA-RISC1.1.
-Justin
vallon@bear.com
***********************************************************************
Bear Stearns is not responsible for any recommendation, solicitation,
offer or agreement or any information about any transaction, customer
account or account activity contained in this communication.
***********************************************************************
|