genji333
genji333

Reputation: 67

Perl 'can't locate object method "worksheets" via package "Spreadsheet::ParseExcel::Workbook"'

I am trying to open two Excel .xls files for comparing. I included

    use Spreadsheet::ParseExcel;    

then, I continue my code as follow:

    my $parser_r   = Spreadsheet::ParseExcel->new();
    my $resultbook = $parser_r->parse($absPathResult);
    my $parser_i   = Spreadsheet::ParseExcel->new();
    my $resultideal = $parser_i->parse($absPathIdeal);

    @worksheetsListResult = $resultbook->worksheets();
    @worksheetsListIdeal = $resultideal->worksheets();

the first error I encountered was "can't locate object method "parser"...", but that was solved by changing "parser" to "Parser".

When I execute the script again, I am getting the error: can't locate object method "worksheets" via package "Spreadsheet::ParseExcel::Workbook".

I am running the script in Linux, Perl v5.8.5.

Any idea what is the possible problem here? I am new to Perl language. All comments are very much appreciated.

PS: When I run the similar code in Windows, everything is working perfectly.

Upvotes: 2

Views: 1173

Answers (1)

Schwern
Schwern

Reputation: 164699

The workbooks() method was added in 0.43, six years ago. Since your version of Perl is rather old (11 years), it's likely your version of Spreadsheet::ParseExcel is also rather old.

You can check with:

perl -MSpreadsheet::ParseExcel -wle 'print $Spreadsheet::ParseExcel::VERSION'

In general, don't use the web documentation for Perl modules unless you're keeping up to date. It probably won't be for your installed version. Instead use perldoc.

Upvotes: 4

Related Questions