end0tknr's kipple - web写経開発

太宰府天満宮の狛犬って、妙にカワイイ

「ブックの保護」なexcelでは、Spreadsheet::ParseExcelがparse()失敗?

Spreadsheet::ParseExcelを使ってexcelファイルをparse仕様としたところ、エラーとなったので、調べてみました。

私の書いたsrc.

   my $parser = Spreadsheet::ParseExcel->new();
   my $wbook = $parser->parse($xls_path);
    unless ( $wbook ) {
        my $msg = join("\n",
                       "excelファイルを開けず、読込に失敗しました.",
                       "$xls_path",
                       $parser->error() );
        $self->error($msg);
        die $msg;
    }

error message.

Issuing rollback() due to DESTROY without explicit disconnect()
  of DBD::mysql::db handle database=baitai;host=localhost
  at /app/baitai/www/cgi/draft.pl line 12.
An error occurred at draft.pl.  
 excelファイルを開けず、読込に失敗しました.
/tmp/144.xls
File is encrypted at /app/baitai/www/lib/Baitai/Model/Input/Excel.pm line 38.

Spreadsheet::ParseExcelで次のように書かれているので、意図してそうなってるのかな?

# If the file contains a FILEPASS record we assume that it is encrypted
# and cannot be parsed.
if ( $record == 0x002F ) {
    $self->{_error_status} = ErrorFileEncrypted;
    return undef;
}