Do you know where your variables are? | |
PerlMonks |
The wonders of Test::Moreby syphilis (Archbishop) |
on May 21, 2022 at 13:29 UTC ( [id://11144043]=perlquestion: print w/replies, xml ) | Need Help?? |
syphilis has asked for the wisdom of the Perl Monks concerning the following question:
Hi,
Have a laugh at this piece of brilliance: Note that the problem arises at C:/perl-5.34.0/site/lib/Test/Builder.pm line 1006. It's not the test failure that's an issue - pretty obviously, that test should fail. It's the ensuing fatal over-the-top blowup that's my main concern. Here's the actual section of the Test::Builder code that blows up: The evaluation of $got eq $expect is bound to be interesting if $got is an object and the 'eq' operator has not been overloaded Anyway ... my question is "what is the bug ?" Is it that 'eq' overloading has not been provided ? (Providing such overloading successfully works around the problem.) Is it that Test::More (or Test::Builder) should not be assuming that 'eq' has been overloaded ? Or has Test::Builder tried (and failed) to account for this possibility. I'm looking at $self->$unoverload( \$got, \$expect ) in the above snippet from Builder.pm, and wondering what that might be intended to do. With math objects, I've never felt the need to be able to compare $obj eq $str. If I need to do that I just make use of the overloaded stringification and compare "$obj" eq $str. I'm interested to hear thoughts on what is the "correct" way to deal with this issue. Cheers, Rob
Back to
Seekers of Perl Wisdom
|
|