Subject: | Text::Column bug |
Date: | Mon, 26 Mar 2012 15:44:35 +0000 |
To: | "bug-Text-Column [...] rt.cpan.org" <bug-Text-Column [...] rt.cpan.org> |
From: | Richard Bernheine <Richard.Bernheine [...] NashTech.Com> |
Hello CPAN maintainer,
I fixed some bugs in the following CPAN module.
Module: Text-Column
Version: 0.5
Perl version: all (tested with 5.14.2 on Linux)
Issue 1) (first diff) :Support undefined values without generating warnings.
Issue 2) (second diff) Text is truncated if column width is too small (the code to add extra lines had a bug)
The problems can be reproduced with the attached perl script.
I would appreciate if someone could apply the fix in next version.
Test with original version:
====================
$> ./text-column.pl
Use of uninitialized value in addition (+) at /usr/lib/perl5/site_perl/5.14.2/Text/Column.pm line 142.
Use of uninitialized value $size in numeric lt (<) at /usr/lib/perl5/site_perl/5.14.2/Text/Column.pm line 161.
Use of uninitialized value $size in substr at /usr/lib/perl5/site_perl/5.14.2/Text/Column.pm line 166.
Use of uninitialized value $r[2] in substr at /usr/lib/perl5/site_perl/5.14.2/Text/Column.pm line 166.
Use of uninitialized value in numeric lt (<) at /usr/lib/perl5/site_perl/5.14.2/Text/Column.pm line 167.
Use of uninitialized value $size in numeric lt (<) at /usr/lib/perl5/site_perl/5.14.2/Text/Column.pm line 167.
Use of uninitialized value $size in subtraction (-) at /usr/lib/perl5/site_perl/5.14.2/Text/Column.pm line 172.
Id Column2 Column3
--- --------------- ----------
1 Short Text c3
2 This descriptio c3
3 Test with undef
Test with patched version
=====================
$> ./text-column.pl
Id Column2 Column3
--- --------------- ----------
1 Short Text c3
2 This descriptio c3
n is longer tha
n the width of
the column. Tex
t will not be t
runkated
3 Short Test 2
Patch to be applied:
=================
-- Text-Column-0.05/lib/Text/Column.pm 2012-03-26 11:03:18.000046000 +0200
+++ Text-Column-0.05-patch/lib/Text/Column.pm 2012-03-26 11:37:04.000011000 +0200
@@ -139,6 +139,7 @@
$r_total = 0;
foreach $r (@r) {
+ $r='' if not defined($r);
$r_total += length( $r);
}
@@ -184,7 +185,7 @@
$r_total = 0;
foreach $r (@r) {
- $r_total = length( $r);
+ $r_total += length( $r);
}
}
@@ -447,4 +448,4 @@
=cut
-### end of file ###
\ No newline at end of file
+### end of file ###
Kind Regards,
Richard Bernheine
[cid:473082307@28102009-3087]
Nash Technologies GmbH
Thurn-und Taxis-Str. 10
D-90411 Nürnberg
richard.bernheine@nashtech.com<mailto:richard.bernheine@nashtech.com>
Tel: +49 (0) 911 /30874 4639
-----------------------------------
Amtsgericht Nürnberg, HRB 24701
Geschäftsführer Udo Nadolski, Dr. Markus Ermer
Message body is not shown because it is too large.
Message body is not shown because sender requested not to inline it.
Message body is not shown because sender requested not to inline it.