Subject: | potential annoying warning in addSectionRow |
Date: | Fri, 19 Mar 2010 14:08:58 -0500 (CDT) |
To: | bug-HTML-Table [...] rt.cpan.org |
From: | Tim Mooney <Tim.Mooney [...] ndsu.edu> |
Hi!
We're using HTML::Table 2.08a on Linux and Solaris (perl 5.8.8 and perl
5.10.1). It's used by some network netflow recording software (flowscan
and flow-tools, from http://net.doit.wisc.edu/~plonka/FlowScan/) that
our networking team rely on.
We recently upgraded the system, and now that HTML::Table 2.08a is being
used, they're getting lots of spurious warnings every time that
addSectionRow is being called:
Use of uninitialized value in numeric gt (>) at
/usr/lib/perl5/site_perl/5.8.8/HTML/Table.pm line 2685.
It looks like the issue is just that $self->{last_col} may not be
defined. A simple fix would be:
diff -ur HTML-Table-2.08a.orig/lib/HTML/Table.pm HTML-Table-2.08a/lib/HTML/Table.pm
--- HTML-Table-2.08a.orig/lib/HTML/Table.pm 2008-06-23 08:42:28.000000000 -0500
+++ HTML-Table-2.08a/lib/HTML/Table.pm 2010-03-19 13:58:37.411038251 -0500
@@ -2682,7 +2682,8 @@
my $count = @_;
# if number of cells is greater than cols, let's assume
# we want to add a column.
- $self->{last_col} = $count if ($count > $self->{last_col});
+ $self->{last_col} = $count if (!defined($self->{last_col})
+ || ($count > $self->{last_col}));
$self->{$section}[$section_num]->{last_row}++; # increment number of rows
for (my $i = 1; $i <= $count; $i++) {
Please let me know if you have any questions or if I'm off-base with
the patch.
Thanks,
Tim
--
Tim Mooney Tim.Mooney@ndsu.edu
Enterprise Computing & Infrastructure 701-231-1076 (Voice)
Room 242-J6, IACC Building 701-231-8541 (Fax)
North Dakota State University, Fargo, ND 58105-5164