Subject: | "Use of uninitialized value in split" when run in "perl -w" mode |
Date: | Thu, 21 Jun 2012 13:53:36 +0200 |
To: | bug-Text-TabularDisplay [...] rt.cpan.org |
From: | Patrick <patrick.kuijvenhoven [...] gmail.com> |
Text::TabularDisplay 1.30 produces warnings in case perl is run in
"-w"-mode and the data contains an "undef".
Step to reproduce:
$ perl -MText::TabularDisplay -w -e 'print
Text::TabularDisplay->new(qw/a b/)->add(1, undef)->render()."\n"'
Output:
Use of uninitialized value in split at
/usr/local/lib/perl5/site_perl/5.8.8/Text/TabularDisplay.pm line 281.
Use of uninitialized value in split at
/usr/local/lib/perl5/site_perl/5.8.8/Text/TabularDisplay.pm line 254.
+---+---+
| a | b |
+---+---+
| 1 | |
+---+---+
The cause is that split() (at least in perl 5.8.8) doesn't like to
split undef values:
$ perl -w -e 'print split("\n", undef);'
Use of uninitialized value in split at -e line 1.