[Chicago-talk] Script creates bad file when not run as root

Jim Jacobus JJacobus at PonyX.com
Wed Dec 13 13:20:52 PST 2006


This is probably a Linux problem, but I'm so perplexed I thought I'd 
ask here. I have script that produces an Excel spreadsheet using the 
"Spreadsheet-WriteExcel-2.17" package from John McNamara -- which is 
excellent by the way. The symptom is a corrupt output file. I have a 
stripped down test script  that just creates  a workbook and one 
worksheet, then closes it--so it is trivial and proves that the code 
is ok. When I run it logged in as root, the file can be loaded into 
Excel, when not run as root, it's corrupt.

I've done all the checking I can think of: looking for duplicate 
modules, checking directory and file ownership and permissions, and 
can't figure out what's going on. I have access to another, shared 
Linux system. When I copied the code to the second machine, script 
creates a good file even though I'm running from a non-root account 
on that machine.
This is most likely a Linux problem, but could anyone suggest any 
debugging techniques I could use besides -W and -T? Believe it or not 
I've been looking at this code for over 14 hours.

For what it's worth, here's my script.
#!/usr/bin/perl -w
     use strict;
     use Spreadsheet::WriteExcel;
     my $workbook = Spreadsheet::WriteExcel->new("perl.xls");
     if (defined($workbook)) { print "workbook defined\n"; } else { 
print "workbook error\n"; }
     my $sheet1 = $workbook->add_worksheet("First sheet");
     if (defined($sheet1)) { print "sheet1 defined\n"; } else { print 
"sheet1 not defined\n"; }
     $workbook->close();
     exit;
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.pm.org/pipermail/chicago-talk/attachments/20061213/f9a3a474/attachment.html 


More information about the Chicago-talk mailing list