in reply to Parsing with HTML::TreeBuilder hangs
You could:
$SIG{ALRM} = sub{die "too long"}; my $xSecs = 1; my $content = ""; eval { alarm $xSecs; my $p = HTML::TreeBuilder->new (); $p->parse($content); alarm 0; }; print "Died after waiting $xSecs" if $@ =~ /^too long/;
|
|---|