Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re^2: Recursively traverse two data structures and test for match

by dragonchild (Archbishop)
on May 23, 2005 at 02:05 UTC ( [id://459417]=note: print w/replies, xml ) Need Help??


in reply to Re: Recursively traverse two data structures and test for match
in thread Recursively traverse two data structures and test for match

That's not a slam on anything that uses overloaded values. There's just a problem with how overloading is done. I wrote about it here. There's just no correct way to compare overloaded values from different classes.

  • In general, if you think something isn't in Perl, try it out, because it usually is. :-)
  • "What is the sound of Perl? Is it not the sound of a wall that people have stopped banging their heads against?"
  • Comment on Re^2: Recursively traverse two data structures and test for match

Replies are listed 'Best First'.
Re^3: Recursively traverse two data structures and test for match
by diotalevi (Canon) on May 23, 2005 at 02:16 UTC
    You didn't understand. If you wished to compare that two structures were identical as if overloading didn't exist, you're out of luck. Test::More's is_deeply doesn't do anything to disable the overloading and to thus act on the data structure transparently.

        Sometimes it should, especially when testing the overloaded objects. It is the lack of any is_deeply test which is able to see through overloading that lead me to do something hokey and do cmp_eq( Data::Dump::Streamer::Dump($a), 'eq', Data::Dump::Streamer::Dump($b) ) tests instead.

        If an overloaded object wanted to pretend to be normal, it can use an utterly normal test and it'll get called as usual. Its the stuff like Test::More which should be able to have x-ray eyes to see through overloading.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others studying the Monastery: (2)
As of 2024-04-20 06:22 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found