|
|
sybperl-l Archive
Up Prev Next
From: Michael Peppler <mpeppler at MBAY dot NET>
Subject: CTlib object
Date: May 14 1998 9:23PM
Roger Hall writes:
>
> Hi,
>
> I hope I'm not doing anything too wrong but perhaps someone can help ?
> I'm trying to create a perl object for my database connections. It all
> works fine until I try to have my own object data. Do I have to define
> my objects' data via ct_connect, which works, or should the code below
> work ?
>
> The line that I have problems with (see sample code) is ...
>
> $this->{'something'} = "This line causes problems.";
See the discussion on handle attributes in the manual. Basically you
need to predefine new attributes in the ct_connect (or new) call, like
this:
sub new {
my $class = shift;
my $this = $class->Sybase::CTlib::ct_connect("user","password","server", undef, {'something' => ''})
|| die "OUCH";
$this->{'something'} = "This should now work...";
$this;
}
Michael
--
Michael Peppler -||- Data Migrations Inc.
mpeppler@datamig.com -||- http://www.mbay.net/~mpeppler
Int. Sybase User Group -||- http://www.isug.com
|