Robustness patch
Ed Avis <[email protected]> Sun, 14 Sep 2003 20:11:29 +0100 (BST)
| Newsgroups | gmane.comp.lang.perl.modules.html-tableextract |
|---|---|
| Message-ID | <[email protected]> |
This patch fixes a crash in HTML::TableExtract when some entries in the object hash are missing. I realize that the crash should not have occurred, and probably indicate some deeper bug which needs to be fixed. However I hope that this patch, providing a more detailed error message, will be a step along the way to fixing the bug. I haven't yet made a test case to reproduce the bug, but if I come across it again I will send one to this list. [email protected] --- HTML-TableExtract-1.08/lib/HTML/TableExtract.pm +++ HTML-TableExtract-1.08-new/lib/HTML/TableExtract.pm @@ -205,7 +205,15 @@ $table = $self->first_table_found; } return () unless ref $table; + if (not defined $self->{_table_mapback}) { + warn 'cannot find my _table_mapback hash'; + return (); + } my $ts = $self->{_table_mapback}{$table}; + if (not defined $ts) { + warn "cannot find $table in my _table_mapback hash"; + return (); + } $ts->rows; } -- Ed Avis <[email protected]> ------------------------------------------------------- This sf.net email is sponsored by:ThinkGeek Welcome to geek heaven. http://thinkgeek.com/sf