I wanted to build an awesome place for people to discuss module specific issues, but I don't have any more time for this, and there are much better places to discuss Perl-related issues. I'd recommend asking your question on Stack Overflow or on Perl Monks.
If you are looking for a Perl tutorial or Perl-related news, I hope these links will serve you well.
Posted on 2008-06-10 15:50:05-07 by fergal in response to 8050
Re: Comparing undef and empty string

Unfortunately I don't have a good suggestion right now. You can force Test::Deep to use stringwise comparison using str() but that'll only be useful you're constructing one side by hand. In your case both sides are constructed by things out of your control.

Just in case you, Test::More::is_deeply considers undef and "" to be equal but I assume since you're using Test::Deep, Test::More::is_deeply is not suitable.

You could do something a little drastic - intercept all the values and convert undef to "". Something like (untested)

{ my $old_descend = \&Test::Deep::descend; local *Test::Deep::descend = sub { my $d1, $d2 = @_; $d1 = "" unless defined $d1; $old_descend->($d1, $d2); } }

It's kinda sucky but descend() is part of Test::Deep's interface (although not documented).

Direct Responses: 8058 | Write a response