Let's see if I can explain what I'm trying to do before I toss code
out...  I have a database with several columns of data.  I want to fetch
all the pertinent info into a single array of arrays and then work on
each row of the data individually.  (I don't want to use fetch() because
there's no telling how long it will take to crunch the data)

So, here's some "simple" code to look at this...

This is in a separate .pm file...

sub getdata {
   my $self = shift;
   my $value = $_[0];

   # DBHANDLER is defined elsewhere (and is definitely called) ...  It's
a MySQL database
   $self->{ARRAYLIST} = $self->{DBHANDLER}->selectall_arrayref("select
row1, row2, row3 from mydb where somevalue=$value");
   $self->{ARRAYCOUNTER} = 0;
   return();
}

sub loadrow {
   my $self = shift;

   if ((defined($self->{ARRAYLIST})) and ($self->{ARRAYCOUNTER} <
scalar(@{$self->{ARRAYLIST}}))) {
      ($self->{ROW1}, $self->{ROW2}, $self->{ROW3} =
${$self->{ARRAYLIST}[$self->{ARRAYCOUNTER}]};
      $self->{ARRAYCOUNTER}++; # Increment the counter
      return(1);  # And return a 1 to indicate success
   }

   return(0);
}

And the main program has something along the lines of :

$obj->getdata($somevalue);
while($obj->loadrow()) {
   # do stuff with the data rows
}

My problem is that it appears that $self->{ROW1}, $self->{ROW2}, and
$self->{ROW3} are not getting any data placed into them.  In fact, I've
been getting this error :

Not a SCALAR reference at
/usr2/local/graphmon/TrendAnalyzer/ClassThreshold.pm line 78.

I'm not sure how to fix this...  Can anyone give me any pointers on how
to make this work?

---------------------------
Jason H. Frisvold
Senior ATM Engineer
Engineering Dept.
Penteledata
CCNA Certified - CSCO10151622
[EMAIL PROTECTED]
---------------------------
"I love deadlines.  I especially like the whooshing sound they make as
they go flying by." -- Douglas Adams [1952-2001]



--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to