On Aug 6, 2004, at 11:35 PM, Thilo Planz wrote:
the way I understand things, this is more a Cocoa problem then a Camelbones problem.
Camelbones just passes arguments through to the Objective-C function, and if "setString" does not like null strings, there is little CB can do about it.
Exactly. An undef value is simply passed as nil to ObjC, and some methods can handle that. To some methods, that's actually a meaningful value - for example, passing undef to NSResponder's setTarget() method tells it to send action methods to the responder chain instead of to a single hard-coded target object.
Methods bridged to Perl aren't written by hand; they're automagically generated by querying the ObjC runtime as to the types of the arguments and return value. The ObjC runtime can't tell whether nil is acceptable or not, because that's not declared as part of a method definition in ObjC.
So, we're left with what Thilo suggested - check for undef before calling a method that can't handle it.
sherm--
