in reply to Re: Error handling with HTML::TableExtract
in thread Error handling with HTML::TableExtract
$te->table(3,3) does not exist in all cases and thus I always use eval instead of a proper error handling.eval { my $url="zzz"; $response = $ua->get($url); if ($response->is_success) { $content=$response->content; } else { next; } $te= HTML::TableExtract->new(keep_html=>0); $te->parse($content); if ($te->table(3,3)->cell(1,0) eq "xxxx") { $a=$te->table(3,3)->cell(1,1); $b=$te->table(3,3)->cell(4,1); } else { $a=$te->table(3,4)->cell(1,1); $b=$te->table(3,4)->cell(4,1); } }; warn $@ if $@; }
|
|---|