user2829196
user2829196

Reputation: 113

Perl Excel::Writer::XLSX-> new( 'myfile.xlsx') generates inappropriate I/O error in Windows 8 env

I'm creating Excel xlsx files through perl's Excel::Writer::XLSX->new('myfile.xlsx') this command seams to abort pretty quickly with this error: -F-: Problems creating new Excel file: Inappropriate I/O control operation myperl.pl line 60.

The code I am using:

use Excel::Writer::XLSX;
my $WookBook = Excel::Writer::XLSX->new( 'OilAuto.xlsx' );
die "-F-: Problems creating new Excel file: $!" unless defined $WorkBook;

The line 60 is the line above creating the file with the new() function

You'll note the above error included the Microsoft (or is it the new() operator error msg itself?) After looking up at CPAN, I found a DIAGNOSTIC link under the new() function, only to have that link get a 'page could not be found' error. So, not getting anywhere, hopefully someone here has seen this error and worked around the problem. Thanks for your time.

Upvotes: 1

Views: 317

Answers (1)

jmcnamara
jmcnamara

Reputation: 41564

You have a typo in your code WookBook != WorkBook.

Adding use warnings and use strict would highlight issues like this:

use warnings;
use Excel::Writer::XLSX;

my $WookBook = Excel::Writer::XLSX->new( 'OilAuto.xlsx' );
die "-F-: Problems creating new Excel file: $!" unless defined $WorkBook;

__END__
Name "main::WorkBook" used only once: possible typo at /tmp/die01.pl line 6.
-F-: Problems creating new Excel file:  at /tmp/die01.pl line 6.

Upvotes: 2

Related Questions