in reply to Is there an andand for Perl like there is in Ruby?

What I've done before is create an object which uses overload to return an object that stringifies to "", numifies as 0, is false in boolean context, but which can have any method called on it and always returns itself. Then have ShopperDueDate return that in the event of that field being missing. Then you can chain method calls as far as you like and look at the return of the last one.

I would have released it to CPAN as Class::Null but there already is a (IMO much less useful) class out there named that. :-(

Update: Apparently the author of that class saw the error of his ways and that class is now the useful class that I just described! :-)

  • Comment on Re: Is there an andand for Perl like there is in Ruby?