From: J. Gleixner on
PerlTrainee wrote:
> Okay, here is the code. Yesterday I was running the following program on Window 7 Professional 64 bit. I thought the OS was the culprit. I got this code from CSPAN website. So, I don't think there could be something wrong with the code. I ran the same code on my home computer with Window XP Professional 32 bit but got the same error.
> What I don't understand is I have specified SaveParser so why it wouldn't look for "AddCell" method there? Why it keeps looking for it in ParseExcel?
> use strict;
> use Spreadsheet::ParseExcel;
> use Spreadsheet::ParseExcel::SaveParser;
> my $parser = Spreadsheet::ParseExcel->new();
> my $workbook1 = $parser->parse('C:\readMe.xls');
> if ( !defined $workbook1 ) {
> die $parser->error(), ".\n";
> }
> my $worksheet1 = $workbook1->worksheet('Sheet1');
> my $parser2 = Spreadsheet::ParseExcel::SaveParser->new();
> my $workbook2 = $parser2->parse('C:\writeMe.xls');

In addition to all of the other comments, The following:

> if (!defined $workbook2) {
> die $parser->error(),".\n";
> }

will call the error method from the Spreadsheet::ParseExcel
class. More than likely, you would want to call error from
the Spreadsheet::ParseExcel::SaveParser class.

die $parser2->error;

Also, note the side effect when you add a newline to die's output.