Problems? Is your data what you think it is? | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
That's deeply confusing
Indeed. To begin with, it was a case of TL;DR, so it took me a couple of weeks to summons the energy to actually look at it ;-) I initially just changed the condition form '!=' to '<' (which was actually a more appropriate condition anyway) and any failures were then reported normally. This issue is actually cropping up in a new module I'm putting together, and there's one particular function that I haven't yet got quite right ... hence the occasional failures. The diagnostics suggest that, after the $unoverload() call, both $got and $expect are still Math::MPFR objects, unaltered in any way. Devel::Peek::Dump() calls done before and after the $unoverload() call, confirm this. $unoverload is the string "_unoverload_num", which by the look of it (I'm guessing) disables the '0+' overloading. There is no '0+' overloadinging in Math::MPFR - I've never bothered with '0+' because I've never hit a case where it serves a useful purpose. AFAIK, when a Math::MPFR object is used in a numeric (unoverloaded) context, then the stringification of that Math::MPFR object is automatically used in numeric context. And that has always served just fine. (Mind you, this new module I'm playing with might well require '0+' overloading, as I doubt that the stringification will DWIM when used in numeric context.) I know there are aspects of overloading that I don't understand well ... and '0+' overloading could well be one of them. I think that Math::GMPq is the only module where I've overloaded '0+', and that was done simply because strings like '11/65537' don't DWIM when used in numeric context. For example, the condition ('11/65537' == '11/2') is TRUE .... and that doesn't DWIM well at all. Cheers, Rob In reply to Re^2: The wonders of Test::More
by syphilis
|
|