After toying around with the code for this module for a bit, I've fixed the problem, hopefully without introducing any new bugs (my understanding of the module is not very complete). This bug is caused by the "class data" at the beginning of Format.pm and Worksheet.pm. The data is actually per-workbook data, but the author of the module mistakenly stored it into class variables, thus applying it to the set of
all worksheets and formats. I've made this mistake so many times myself, it was quite easy to recognize :) Anyway, I've whipped up a quick patch to get things working. One caveat with the patch though, is that you have to explicitly
close() your workbooks, because the order in which objects get DESTROY'd is random.
diff -r c:\perl\site\lib\Spreadsheet/Format.pm C:\Perl\CPAN\Spreadshee
+t-WriteExcel-0.22/Format.pm
32,33c32,33
< # my $xf_index = 15;
< # my $font_index = 4;
---
> my $xf_index = 15;
> my $font_index = 4;
47,49c47
< _workbook => $_[1],
< _xf_index => $_[1]->{_xf_index}, #MEOW
< _font_index => $_[1]->{_font_index}, #MEOW
---
> _xf_index => $xf_index,
50a49
> _font_index => $font_index,
89,90c88,89
< $self->{_workbook}{_xf_index}++;
< $self->{_workbook}{_font_index}++;
---
> $xf_index++;
> $font_index++;
diff -r c:\perl\site\lib\Spreadsheet/Workbook.pm C:\Perl\CPAN\Spreadsh
+eet-WriteExcel-0.22/Workbook.pm
38,39d37
< bless $self, $class;
<
49,52c47,48
< $self->{_xf_index} = 15;
< $self->{_font_index} = 4;
< $self->{_tmp_worksheet} = Spreadsheet::Worksheet->new('', 0, 0,
+ $self);
< $self->{_tmp_format} = Spreadsheet::Format->new($self);
---
> $self->{_tmp_worksheet} = Spreadsheet::Worksheet->new('', 0, 0)
+;
> $self->{_tmp_format} = Spreadsheet::Format->new();
55a52
> bless $self, $class;
133d129
< $self, #MEOW
152c148
< my $format = Spreadsheet::Format->new($self);
---
> my $format = Spreadsheet::Format->new();
diff -r c:\perl\site\lib\Spreadsheet/Worksheet.pm C:\Perl\CPAN\Spreads
+heet-WriteExcel-0.22/Worksheet.pm
32,33c32,33
< #MEOW my $active_sheet = 0;
< #MEOW my $first_sheet = 0;
---
> my $active_sheet = 0;
> my $first_sheet = 0;
53d52
< $self->{_workbook} = $_[3]; #MEOW
200c199
< $self->{_workbook}{_active_sheet} = $self->{_index}; #MEOW
---
> $active_sheet = $self->{_index};
212,214c211
< my $self = shift; #MEOW
<
< $self->{_workbook}{_active_sheet}; #MEOW
---
> return $active_sheet;
229c226
< $self->{_workbook}{_first_sheet} = $self->{_index}; #MEOW
---
> $first_sheet = $self->{_index};
241,243c238
< my $self = shift;
<
< $self->{_workbook}{_first_sheet}; #MEOW
---
> return $first_sheet;
341c336
< if ($self->{_workbook}{_active_sheet} == $self->{_index}) {
---
> if ($active_sheet == $self->{_index}) {