[CDBI] cdbi objects evaluating as false

Aaron Trevena aaron.trevena at gmail.com
Sat Nov 25 17:45:06 GMT 2006

On 25/11/06, Matt S Trout <dbix-class at trout.me.uk> wrote:
> What's wrong with
> while (defined (my $object = $iterator->next)) {
>    ...
> }
> ?
> In general you want to do that anyway with stuff that might stringify
> just in case the stringification turns out to be an expensive
> operation or whatever ...

Nothing is wrong with it, it's a better alternative than what else I
was doing, but it's still not the plain loop you would expect, on the
plus side not only does it save any potentially expensive
stringification (fortunately we don't have that in this case), but it
also warns anybody maintaining that the object could be defined but
false in case they were hoping to do something somewhere else, which
reminds me I need to put a caveat along these lines in the pod.

So I think I'll go with that - now I just need to be able to do the
same in TT, where I am using the same iterator and horrid variation on
the while loop. bah.



LAMP System Integration, Development and Hosting

More information about the ClassDBI mailing list