Skip Menu |

This queue is for tickets about the Spreadsheet-WriteExcel CPAN distribution.

Maintainer(s)' notes

If you are reporting a bug in Spreadsheet::WriteExcel here are some pointers

1) State the issues as clearly and as concisely as possible. A simple program or Excel test file (see below) will often explain the issue better than a lot of text.

2) Provide information on your system, version of perl and module versions. The following program will generate everything that is required. Put this information in your bug report.

    #!/usr/bin/perl -w

    print "\n    Perl version   : $]";
    print "\n    OS name        : $^O";
    print "\n    Module versions: (not all are required)\n";

    my @modules = qw(
                      Spreadsheet::WriteExcel
                      Parse::RecDescent
                      File::Temp
                      OLE::Storage_Lite
                      IO::Stringy
                      Spreadsheet::ParseExcel
                      Scalar::Util
                      Unicode::Map
                    );

    for my $module (@modules) {
        my $version;
        eval "require $module";

        if (not $@) {
            $version = $module->VERSION;
            $version = '(unknown)' if not defined $version;
        }
        else {
            $version = '(not installed)';
        }

        printf "%21s%-24s\t%s\n", "", $module, $version;
    }

    __END__

3) Upgrade to the latest version of Spreadsheet::WriteExcel (or at least test on a system with an upgraded version). The issue you are reporting may already have been fixed.

4) Create a small but complete example program that demonstrates your problem. The program should be as small as possible. At the same time it should be a complete program that generates an Excel file. If the Spreadsheet::WriteExcel section is part of a much larger program then simplify it down to the essentials. Simulate any DB reads with an array.

5) Say if you tested with Excel, OpenOffice, Gnumeric or something else. Say which version of that application you used.

6) If you are submitting a patch you should check with the author whether the issue has already been patched or if a fix is in the works. Patches should be accompanied by test cases.

Asking a question

If you would like to ask a more general question there is the Spreadsheet::WriteExcel Google Group.

Report information
The Basics
Id: 13133
Status: resolved
Priority: 0/
Queue: Spreadsheet-WriteExcel

People
Owner: Nobody in particular
Requestors: angaur [...] q8.nl
Cc:
AdminCc:

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



Subject: workbook->close() returns 'Bad file descriptor' error
I'm using activestate perl 5.8.6 on Windows 2000 server When doing an explicit workbook->close() it now returns with error 'Bad file descriptor'. Didn't have this problem in the previous perl 5.6 version of activestate. Resulting excel spreadsheet seems fine.
[guest - Tue Jun 7 06:02:19 2005]: Show quoted text
> I'm using activestate perl 5.8.6 on Windows 2000 server > When doing an explicit workbook->close() > it now returns with error 'Bad file descriptor'.
I can't reproduce this. The following doesn't give any error with ActivePerl 5.8.6 on WinXP: #!/usr/bin/perl -w use strict; use Spreadsheet::WriteExcel; my $workbook = Spreadsheet::WriteExcel->new("close.xls"); my $worksheet = $workbook->add_worksheet(); $worksheet->write('A1', "Hello"); $workbook->close(); Can you post an example program that demonstrates the problem. Also include the module version numbers from the output of the bug_report.pl program in the examples directory of the distro. John. --
From: angaur [...] q8.nl
Your example is fine. I only added a line to print the returncode and the $!. It's attached to this email. And here is the info from bug_report.pl Perl version : 5.008006 OS name : MSWin32 Module versions: (not all are required) Spreadsheet::WriteExcel 2.14 Parse::RecDescent 1.94 File::Temp 0.14 OLE::Storage_Lite 0.13 IO::Stringy 2.110 Anand
#!C:/Perl/bin/perl.exe use strict; use Spreadsheet::WriteExcel; my $workbook = Spreadsheet::WriteExcel->new("close.xls"); my $worksheet = $workbook->add_worksheet(); $worksheet->write('A1', "Hello"); my $rc = $workbook->close(); print "#RC: $rc#$!#\n";
Looks like a bug. :-) Interestingly, it only seems to happen on Windows. I'll dig into it a little more and let you know. John. --
This looks like it is a bug/feature of ActivePerl 5.8.6 ad 5.8.7. It doesn't happen in 5.6.1 or 5.005 or with perl 5.8.6 on other platforms. The $! variable is set at an earlier part of the program as a result of a read() on a filehandle. It isn't connected with close(). The following program demonstrates: #!/usr/bin/perl -w use strict; open TMP, "+>file.txt" or die "Couldn't open file: $!"; print TMP "Test string.\n\n"; seek TMP, 0, 0; my $str; my $read; while ($read = read(TMP, $str, 4096)) { print $str; } my $close = close TMP; print "Read:\t", $read, "\nClose:\t", $close, "\n\$!: \t", $!, "\n"; __END__ C:\Work>c:/perl505/bin/perl close3.pl Test string. Read: 0 Close: 1 $!: C:\Work>c:/perl561/bin/perl close3.pl Test string. Read: 0 Close: 1 $!: C:\Work>c:/perl586/bin/perl close3.pl Test string. Read: 0 Close: 1 $!: Bad file descriptor Clearly the ActivePerl 5.8.6 behaviour is inconsistent with older versions and also with the same version on other platform. However, it is probably incorrect to examine $! unless close() (or some other file operation) fails. As such you should ignore $! unless close() fails (in which case it will be set to the correct value). John. --