see programming perl book ---- overloading chapter ,
On Thu, Oct 6, 2011 at 6:37 AM, Jenda Krynicky <[email protected]> wrote: > From: Phillip Richcreek <[email protected]> > > > I'm going to use a package called Data::Money in place of a similar > > module that I had previously used but is no longer available for > > downloading/ installing. Data::Money does everything that the other > > package does (as far as the features that I am using), and it would > > pretty much be a drop-in replacement but for one difference: > > Data::Money does not overload the == and != but instead overloads the > > <=> operator. So where I'm using " if ($a==$b)" and if($A!=$b)" a lot > > of places, I'd have to change these to " if (! ($a<=>$b)) ?" some > > places and "if($a<=>$b) ?" other places. I think I might also be using > > some < and >, which would require way beyond just find and replace. > > I don't think you need to do any of this. According to the docs the > other comparison operators are autogenerated if the <=> is defined. > > See > perldoc overload > section "MAGIC AUTOGENERATION". > > Jenda > ===== [email protected] === > http://Jenda.Krynicky.cz<http://jenda.krynicky.cz/>===== > When it comes to wine, women and song, wizards are allowed > to get drunk and croon as much as they like. > -- Terry Pratchett in Sourcery > > _______________________________________________ > ActivePerl mailing list > [email protected] > To unsubscribe: > http://listserv.ActiveState.com/mailman/mysubs<http://listserv.activestate.com/mailman/mysubs> > -- Yours Sincerely Zeng Hong
_______________________________________________ ActivePerl mailing list [email protected] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
