[CDBI] cdbi objects evaluating as false

"Aaron Trevena" <[email protected]>
Newsgroups gmane.comp.lang.perl.modules.class-dbi
Message-ID <[email protected]>
Hi all,

I'm finding that when I do :

while (my $object = $iterator->next) {
..
}

.. the loop never happens because 'my $object = $iterator->next' seems
to be false.

instead I have to do :

my $object = $iterator->next();
while (defined $object && $object->pk) {
  . . .
  $object = $iterator->next();
}

I'm using a wrapper around CDBI iterator, but given both iterators
return the next object, so I don't see any reason for them to have
different results.

I'm hoping there is something I can do to make these objects 'true'
when provided by the iterator so that I can use the normal while loop.

Any suggestions, hints and reasons why I'm having the problem or being
stupid much appreciated.

cheers,

A.

-- 
http://www.aarontrevena.co.uk
LAMP System Integration, Development and Hosting
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.