[Dbix-class] What should DBIC objects stringify to?

Matija Grabnar matija at literal.si
Wed May 3 14:06:30 CEST 2006


While programming in CDBI I got used to this paradigm:
$obj = $something->search({whatever});
if ($obj) {
    # do something with the result
} else {
    # we got an empty result
}

In other words, in CDBI results stringify (if that's the wrong word, 
please enlighten me) into undef (or some other false value) if they 
don't contain any elements, and to the primary key otherwise.

I understand that this is somewhat trickier with DBIC, considering DBIC 
objects can easily have multiple primary keys.

But could we still have something resolving to a false value when a 
search returns
nothing? Or am I missing something in the docs?





More information about the Dbix-class mailing list