in reply to
Re: Moose: return null object
in thread Moose: return null object
As long as the class...returns something for failure
Well, obviously there is no choice about that, lol. No matter what, it is going to return a hash ref.
I'd rather just set an "ok" Bool attribute in BUILD than use eval. It is not that I'm worried about invalid args (strings for ints, or whatever), it's to do with otherwise valid args in cases where the object cannot be created because of a program logic constraint.
So all that's fine, just it seems (very) silly (as in: pointlessly silly, silly oversight kind of silly) that you cannot return undef from a "new" call, and thot perhaps I'd missed something. But I'm not here to pick on Moose either ;)