i wrote some code to do this a while back.
anders pearson
In reply to Re: Need a test for deep equality by thraxil in thread Need a test for deep equality by rinceWind