[ome-devel] findObject problem

august august at develop.ment.org
Thu Dec 7 17:43:18 GMT 2006


> Hi August
> Wrapping in an eval isn't really over-kill (brace eval, not string) -  
> its the recommended way to catch exceptions.


oh, ok.  I'm no perl expert....just learning it as I go with OME.
Somehow, I remember being told that  the brace eval actualy starts
another perl interpreter, which seems to me like it would be something
to avoid.

> You could also check first by finding the OME::SemanticType you're  
> looking for:
> $factory->findObject('OME::SemanticType', 'name' => 'Myattribute' );
> These factory calls work for any class that inherits from  
> OME::DBObject, which is every class that persists in the DB,  
> including "system classes".


ok,. yeah....that should do what I need I think.


> I would argue against returning undef because you've asked for an  
> object of undefined type.  It seems more like an exception to me, and  
> is useful as such for trapping bugs in code.  Otherwise it would  
> return undef for two very different conditions:  Object type not  
> defined, and Object type defined, but no instances matching criteria.

I guess you are right.....but as a user it seems to me that when you ask
to find an object or a list of objecits, you logicaly expect to get an
empty list if that object doesn't exist.   


thanks for the help -august.


More information about the ome-devel mailing list