Seralize empty list as undef.

This commit is contained in:
Daniel Nichter
2013-02-18 12:51:28 -07:00
parent 97f963c7f7
commit 6d1c96e445
2 changed files with 7 additions and 1 deletions

View File

@@ -161,7 +161,7 @@ sub join_quote {
sub serialize_list {
my ( $self, @args ) = @_;
PTDEBUG && _d('Serializing', Dumper(\@args));
die "Cannot serialize an empty array" unless scalar @args;
return unless @args;
my @parts;
foreach my $arg ( @args ) {

View File

@@ -126,6 +126,12 @@ is( $q->join_quote('`db`', '`foo`.`tbl`'), '`foo`.`tbl`', 'join_merge(`db`, `foo
# (de)serialize_list
# ###########################################################################
is(
$q->serialize_list( () ),
undef,
'Serialize empty list returns undef'
);
binmode(STDOUT, ':utf8')
or die "Can't binmode(STDOUT, ':utf8'): $OS_ERROR";
binmode(STDERR, ':utf8')