Subject: | sometimes empty strings serialise to undef |
perl -v
v5.8.8 built for i586-linux-thread-multi
uname -a
Linux delta 2.6.18.2-34-default #1 SMP Mon Nov 27 11:46:27 UTC 2006
i686 athlon i386 GNU/Linux
perl -MData::Dump::Streamer -e'print Data::Dump::Streamer->VERSION'
2.30
Under some circumstances empty strings serialise to undef, additionally
a warning is emitted. Example:
$ perl -e'use DDS; Dump [undef, q{}]'
$ARRAY1 = [
Use of uninitialized value in string ne at .../Data/Dump/Streamer.pm
line 2575.
( undef ) x 2
];
Tests:
use DDS;
use Test::More tests => 6;
my @list = ('', undef);
is_deeply @list, eval Dump(@list)->Out; # fail
my @other_list = (undef, '');
is_deeply @other_list, eval Dump(@other_list)->Out; # fail
my $simple_aref = ['', undef];
is_deeply $simple_aref, eval Dump($simple_aref)->Out; # ok
my $other_simple_aref = [undef, ''];
is_deeply $other_simple_aref, eval Dump($other_simple_aref)->Out; #
fail
my $complex_aref = [['', undef]];
is_deeply $complex_aref, eval Dump($complex_aref)->Out; # ok
my $other_complex_aref = [[undef, '']];
is_deeply $other_complex_aref, eval Dump($other_complex_aref)->Out; #
fail