Skip Menu |

This queue is for tickets about the SimpleXlsx CPAN distribution.

Report information
The Basics
Id: 80284
Status: open
Priority: 0/
Queue: SimpleXlsx

People
Owner: JESTOCK [...] cpan.org
Requestors: kclark [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Critical
Broken in: 0.0.4
Fixed in: (no value)



Subject: Hash/arrayref problems
Treats a hashref like an arrayref. Loads of warnings on uninitialized values. The attached diff takes care of these. Thanks! Ken
Subject: SimpleXlsx.pm.diff
90a91 > $DB::single = 1; 92c93,94 < for my $ind (0 .. $#{$xborders}) --- > # for my $ind (0 .. $#{$xborders}) > for my $ind ( keys %$xborders ) 98,99c100,101 < 'Color' => defined $xborders->[$ind]->{'left'}->{'color'}->{'indexed'} ? $xborders->[$ind]->{'left'}->{'color'}->{'indexed'} : '', < 'Style' => defined $xborders->[$ind]->{'left'}->{'style'} ? $xborders->[$ind]->{'left'}->{'style'} : '' --- > 'Color' => defined $xborders->{ $ind }->{'left'}->{'color'}->{'indexed'} ? $xborders->{ $ind }->{'left'}->{'color'}->{'indexed'} : '', > 'Style' => defined $xborders->{ $ind }->{'left'}->{'style'} ? $xborders->{ $ind }->{'left'}->{'style'} : '' 103,104c105,106 < 'Color' => defined $xborders->[$ind]->{'right'}->{'color'}->{'indexed'} ? $xborders->[$ind]->{'right'}->{'color'}->{'indexed'} : '', < 'Style' => defined $xborders->[$ind]->{'right'}->{'style'} ? $xborders->[$ind]->{'right'}->{'style'} : '' --- > 'Color' => defined $xborders->{ $ind }->{'right'}->{'color'}->{'indexed'} ? $xborders->{ $ind }->{'right'}->{'color'}->{'indexed'} : '', > 'Style' => defined $xborders->{ $ind }->{'right'}->{'style'} ? $xborders->{ $ind }->{'right'}->{'style'} : '' 108,109c110,111 < 'Color' => defined $xborders->[$ind]->{'top'}->{'color'}->{'indexed'} ? $xborders->[$ind]->{'top'}->{'color'}->{'indexed'} : '', < 'Style' => defined $xborders->[$ind]->{'top'}->{'style'} ? $xborders->[$ind]->{'left'}->{'top'} : '' --- > 'Color' => defined $xborders->{ $ind }->{'top'}->{'color'}->{'indexed'} ? $xborders->{ $ind }->{'top'}->{'color'}->{'indexed'} : '', > 'Style' => defined $xborders->{ $ind }->{'top'}->{'style'} ? $xborders->{ $ind }->{'left'}->{'top'} : '' 113,114c115,116 < 'Color' => defined $xborders->[$ind]->{'bottom'}->{'color'}->{'indexed'} ? $xborders->[$ind]->{'bottom'}->{'color'}->{'indexed'} : '', < 'Style' => defined $xborders->[$ind]->{'bottom'}->{'style'} ? $xborders->[$ind]->{'bottom'}->{'style'} : '' --- > 'Color' => defined $xborders->{ $ind }->{'bottom'}->{'color'}->{'indexed'} ? $xborders->{ $ind }->{'bottom'}->{'color'}->{'indexed'} : '', > 'Style' => defined $xborders->{ $ind }->{'bottom'}->{'style'} ? $xborders->{ $ind }->{'bottom'}->{'style'} : '' 118,119c120,121 < 'Color' => defined $xborders->[$ind]->{'diagonal'}->{'color'}->{'indexed'} ? $xborders->[$ind]->{'diagonal'}->{'color'}->{'indexed'} : '', < 'Style' => defined $xborders->[$ind]->{'diagonal'}->{'style'} ? $xborders->[$ind]->{'diagonal'}->{'style'} : '' --- > 'Color' => defined $xborders->{ $ind }->{'diagonal'}->{'color'}->{'indexed'} ? $xborders->{ $ind }->{'diagonal'}->{'color'}->{'indexed'} : '', > 'Style' => defined $xborders->{ $ind }->{'diagonal'}->{'style'} ? $xborders->{ $ind }->{'diagonal'}->{'style'} : '' 213a216 > no warnings 'uninitialized';
Could you retest this in version 0.05 and see if it can still be reproduced? If so, I'll get your patch implemented and submitted.
El Jue Jul 25 16:47:02 2013, JESTOCK escribió: Show quoted text
> Could you retest this in version 0.05 and see if it can still be > reproduced? If so, I'll get your patch implemented and submitted.
v0.05 have the same problem. The problem is with XML::Simple: if a node of xml file have one item, XML::Simple create a hashref, not arrayref. Solutions: 1) Use another XML module ;) 2) Tell to XMLin() what attributes we want it change to arrayref. The next patch solves the problems of v0.05: 43c43 < my($tstrings) = $xml->XMLin($sstrings); --- Show quoted text
> my($tstrings) = $xml->XMLin($sstrings, ForceArray => ['si']);
62,63c62,63 < $data = $xml->XMLin($data); < --- Show quoted text
> $data = $xml->XMLin($data, ForceArray => ['xf','font','border']); >
145c145 < --- Show quoted text
>
156,157c156,157 < my($data) = $xml->XMLin($contents); < --- Show quoted text
> my($data) = $xml->XMLin($contents, ForceArray => ['row','mergeCell','c']);