Test-Deep - Comparing undef and empty string

Posted on Tue Jun 10 18:27:16 2008 by ghendricks
Comparing undef and empty string
First off, thanks so much for Test::Deep. It is a life saver.

I am running into a problem that I hope you can point me in the right direction for solving. I am using Test::Deep to compare the results of a SOAP::Lite XMLRPC call to the original blessed object. The blessed objects come from a database in which some fields are null which become undef in Perl. The problem is that XMLRPC interprets these null fields as empty strings ('') and when I compare the two, it fails. What I am wondering is if there is a way to tell Test::Deep to treat empty string and undef as equal. For that matter it would be great if there was a way to compare any "falsy" value with another or any "truthy" value with another and have it pass.

I have pored over the documentation and have come up empty. Any suggestions?
Direct Responses: 8051 | Write a response