Skip Menu |

This queue is for tickets about the Data-Table CPAN distribution.

Report information
The Basics
Id: 18989
Status: resolved
Priority: 0/
Queue: Data-Table

People
Owner: Nobody in particular
Requestors: smithav [...] cshl.edu
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 1.44
Fixed in: (no value)



Subject: Last column name shortened
I am running Data::Table-1.44 on 'Linux 2.4.21-37.EL #1 SMP Wed Sep 7 13:32:18 EDT 2005 x86_64 x86_64 x86_64 GNU/Linux' with perl 5.8.0. The following bug will likely affect all users regardless of OS or Perl version. With the new code for OS specific delimiters, there is a bug in the 'fromTSV' function, where the last column name is truncated by one character. There is a 'chop' which should be commented out. open(SRC, $name) or confess "Cannot open $name to read"; my @data = (); my $oldDelimiter=$/; my $newDelimiter=($OS==2)?"\r":(($OS==1)?"\r\n":"\n"); $/=$newDelimiter; $_=<SRC>; $_=~ s/$newDelimiter$//; unless ($_) { confess "Empty data file" unless $givenHeader; $/=$oldDelimiter; return new Data::Table(\@data, \@header, 0); } chop; <== '!!!bug' BTW, I prefer 'chomp' for removing newlines, to try and help prevent this type of error. Thanks, -albert PS. Data::Table is joy to work with. :-)