[aix-pm-cvs] modules/util/Util Simple_CSV.pm,1.45,1.46
Status: Alpha
Brought to you by:
gonter
|
From: Gerhard G. <go...@us...> - 2014-11-03 12:48:55
|
Update of /cvsroot/aix-pm/modules/util/Util In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv8585/Util Modified Files: Simple_CSV.pm Log Message: deal with undef index values Index: Simple_CSV.pm =================================================================== RCS file: /cvsroot/aix-pm/modules/util/Util/Simple_CSV.pm,v retrieving revision 1.45 retrieving revision 1.46 diff -C2 -d -r1.45 -r1.46 *** Simple_CSV.pm 25 Sep 2014 17:16:05 -0000 1.45 --- Simple_CSV.pm 3 Nov 2014 12:48:52 -0000 1.46 *************** *** 739,743 **** index rows by given field name. Use lowercase, if to_lower is true. ! BUG: only works with data records. =cut --- 739,747 ---- index rows by given field name. Use lowercase, if to_lower is true. ! BUG: ! * only works with data records. ! * if the value of the index field is not defined, the record is index ! under ''; (before a warning might have been emmitted) ! TODO: maybe a different default value should be used. =cut *************** *** 753,757 **** foreach my $row (@{$csv->{'data'}}) { ! my $av= $row->{$field}; $av=~ tr/A-Z/a-z/ if ($lower); push (@{$IDX{$av}}, $row); --- 757,762 ---- foreach my $row (@{$csv->{'data'}}) { ! my $av= $row->{$field} || ''; ! # DO NOT drop this row if $av is undefined! $av=~ tr/A-Z/a-z/ if ($lower); push (@{$IDX{$av}}, $row); |