views:

742

answers:

1

When the perl code is run the program generates some warnings and terminates. The output is as below:

D:\Perl\bin\search tool>perl testa.pl 
UTF-16 surrogate 0xdb79 at D:/Perl/site/lib/Spreadsheet/ParseExcel/FmtDefault.pm line 81. 
UTF-16 surrogate 0xdbb1 at D:/Perl/site/lib/Spreadsheet/ParseExcel/FmtDefault.pm line 81. 
UTF-16 surrogate 0xd83e at D:/Perl/site/lib/Spreadsheet/ParseExcel/FmtDefault.pm line 81. 
UTF-16 surrogate 0xdff8 at D:/Perl/site/lib/Spreadsheet/ParseExcel/FmtDefault.pm line 81. 
UTF-16 surrogate 0xdbff at D:/Perl/site/lib/Spreadsheet/ParseExcel/FmtDefault.pm line 81. 
UTF-16 surrogate 0xdd98 at D:/Perl/site/lib/Spreadsheet/ParseExcel/FmtDefault.pm line 81. 
substr outside of string at D:/Perl/site/lib/Spreadsheet/ParseExcel.pm line 1196. 
Use of uninitialized value in unpack at D:/Perl/site/lib/Spreadsheet/ParseExcel.pm line 1196. 
substr outside of string at D:/Perl/site/lib/Spreadsheet/ParseExcel.pm line 1196.
Use of uninitialized value in unpack at D:/Perl/site/lib/Spreadsheet/ParseExcel.pm line 1196. 
Out of memory!

The system information is as below :

Perl version : 5.010000 OS name : MSWin32 Module versions: (not all are required) Spreadsheet::ParseExcel 0.49 Scalar::Util 1.19 Unicode::Map (not installed) Spreadsheet::WriteExcel (not installed) Parse::RecDescent (not installed) File::Temp 0.18 OLE::Storage_Lite 0.18 IO::Stringy 2.110

The perl code is as below :

use strict; 
    use Spreadsheet::ParseExcel; 
    my $parser = Spreadsheet::ParseExcel->new( 
        CellHandler => \&cell_handler, 
        NotSetCell  => 1 
    ); 
    my $workbook = $parser->Parse('testfile.xls'); 
    sub cell_handler { 
        my $workbook    = $_[0]; 
        my $sheet_index = $_[1]; 
        my $row         = $_[2]; 
        my $col         = $_[3]; 
        my $cell        = $_[4]; 
        print $cell->unformatted(), "\n"; 
    }

I have the sample testfile.xls also.

+4  A: 

This question was answered on the Spreadsheet::ParseExcel Google Group here.

The problem is that the particular file is encrypted.

John.

jmcnamara
How to detect those type of files programmatically ?
Pankaj
You should ask that in a separate question.
jrockway