Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re^4: Mocking isa under Test::Deep (blessed vs isa)

by tye (Sage)
on May 03, 2016 at 17:26 UTC ( #1162122=note: print w/replies, xml ) Need Help??


in reply to Re^3: Mocking isa under Test::Deep (sentinel)
in thread Mocking isa under Test::Deep

appears (to me) to be digging into the guts of perl (via Scalar::Util::blessed()) to prevent their users from using fairly ordinary OO techniques to bypass their checks

Actually not. You could remove the use of Scalar::Util::blessed() and the code would function identically. Test::Deep is using isa() to enable users to extend the Test::Deep::Cmp functionality using ordinary OO techniques.

If they had actually used blessed() in a way that prevents such extending then the "breaking change" would have been avoided. Replace the new code:

if (! $Expects and Scalar::Util::blessed($d1) and $d1->isa("Test::Deep +::Cmp"))

with code that looks too closely under the covers:

if (! $Expects and Scalar::Util::blessed($d1) eq "Test::Deep::Cmp")

and the fact that isa() was intentionally broken in order to do a sloppy hack to subvert draconian type checking would not have mattered.

- tye        

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1162122]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (7)
As of 2019-10-22 03:24 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Notices?