leszekdubiel has asked for the wisdom of the Perl Monks concerning the following question:
This program:
#!/usr/bin/perl use Spreadsheet::ParseXLSX; `echo "" >/tmp/invalid.xlsx`; eval { Spreadsheet::ParseXLSX->new->parse("/tmp/invalid.xlsx") };
prints:
format error: file is too short at /usr/share/perl5/Archive/Zip/Archive.pm line 1031. Archive::Zip::Archive::_findEndOfCentralDirectory(Archive::Zip::Ar +chive=HASH(0x56216520bf48), IO::File=GLOB(0x562165214f30)) called at +/usr/share/perl5/Archive/Zip/Archive.pm line 761 Archive::Zip::Archive::readFromFileHandle(Archive::Zip::Archive=HA +SH(0x56216520bf48), IO::File=GLOB(0x562165214f30), "/tmp/invalid.xlsx +") called at /usr/share/perl5/Archive/Zip/Archive.pm line 729 Archive::Zip::Archive::read(Archive::Zip::Archive=HASH(0x56216520b +f48), "/tmp/invalid.xlsx") called at /usr/share/perl5/Spreadsheet/Par +seXLSX.pm line 63 Spreadsheet::ParseXLSX::parse(Spreadsheet::ParseXLSX=HASH(0x562165 +1e94d8), "/tmp/invalid.xlsx") called at ./quiete_xlsx line 8 eval {...} called at ./quiete_xlsx line 7
How can I grab all erorrs to some variable without polluting stderr?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Make Spreadsheet::ParseXLSX be quiet about errors ($SIG{__WARN__} )
by LanX (Saint) on Aug 18, 2022 at 15:42 UTC | |
by leszekdubiel (Scribe) on Aug 18, 2022 at 18:42 UTC | |
by LanX (Saint) on Aug 18, 2022 at 19:31 UTC | |
|
Re: Make Spreadsheet::ParseXLSX be quiet about errors
by kcott (Archbishop) on Aug 19, 2022 at 08:15 UTC | |
|
Re: Make Spreadsheet::ParseXLSX be quiet about errors
by NERDVANA (Priest) on Aug 20, 2022 at 13:29 UTC |