Spreadsheet-ParseExcel - Re: how to trap error when parsing corrupted xls file

Posted on Wed May 9 07:33:44 2007 by bosh in response to 5065 (See the whole thread of 4)
Re: how to trap error when parsing corrupted xls file
because combining php and perl could lead you into complicated problem (as I did)
ones giving me simple solver, just use time out (alarm) feature

local $SIG{ALRM} = sub { die("TIMED OUT") }; eval { alarm(20); #set our alarm for 20 seconds $wBook = $fExcel->Parse($filename); #parse xls file alarm(0); }; if ( $@ =~ /TIMED OUT/ ) { print "file $filename load error! time out on processing, could be corrupt!\n"; goto ended; }; not_ended_runs_here: ....

it solved my problem!
it uses same concept as php module which I try before, that php module also use timeout feature too
Write a response