Perl 禁用 Archive::Extract 错误消息
Perl disable Archive::Extract erro rmessages
在 Perl
我有下面几行
my $hu_unzip = Archive::Extract->new( archive => $dest_path.'\one.zip' );
my $ok1 = $hu_unzip->extract( to => $dest_path );
my $rse_unzip = Archive::Extract->new( archive => $dest_path.'\two.zip' );
my $ok2 = $rse_unzip->extract( to => $dest_path );
但是当我 运行 收到以下消息时,但仍然 unzip
正常发生。
format error: bad signature: 0x00000a00 at offset -1 in file E:\Folder\New\one.zip Archive::Zip::_readSignature('IO::File=GLOB(0x23f9644)'
这里我不想打印这个 error
。
那我该怎么办
将 $Archive::Extract::WARN
设置为 false。
文档指出:
This variable controls whether errors encountered internally by Archive::Extract should be carp'd or not.
Set to false to silence warnings. Inspect the output of the error() method manually to see what went wrong.
在 Perl
我有下面几行
my $hu_unzip = Archive::Extract->new( archive => $dest_path.'\one.zip' );
my $ok1 = $hu_unzip->extract( to => $dest_path );
my $rse_unzip = Archive::Extract->new( archive => $dest_path.'\two.zip' );
my $ok2 = $rse_unzip->extract( to => $dest_path );
但是当我 运行 收到以下消息时,但仍然 unzip
正常发生。
format error: bad signature: 0x00000a00 at offset -1 in file E:\Folder\New\one.zip Archive::Zip::_readSignature('IO::File=GLOB(0x23f9644)'
这里我不想打印这个 error
。
那我该怎么办
将 $Archive::Extract::WARN
设置为 false。
文档指出:
This variable controls whether errors encountered internally by Archive::Extract should be carp'd or not. Set to false to silence warnings. Inspect the output of the error() method manually to see what went wrong.