in reply to Re^6: HTML::TableExtract (parse table column from an HTML page)
in thread HTML::TableExtract (parse table column from an HTML page)

The only reason you'd get that is if $table is not returned from $te->first_table_found.

Try this to see whether HTML::TableExtract (which ISA HTML::Parser) has correctly parsed the HTML:

  $te->parse($content) || die "couldn't parse HTML\n";

-David

Replies are listed 'Best First'.
Re^8: HTML::TableExtract (parse table column from an HTML page)
by cafaro (Novice) on Oct 07, 2007 at 13:49 UTC
    My code didn't died while parsing the content.

      OK let's take WWW::Mechanize out of the equation, for the moment. Does this stand-alone snippet work for you?

      use strict; use warnings; use HTML::TableExtract qw/ tree /; my $html = <<EOT; <html> <head> <title>test page</title> <head> <body> <table> <tr><td>parse me</td></tr> </table> </body> </html> EOT my $te = HTML::TableExtract->new; $te->parse($html); my $table = $te->first_table_found; my $tree = $table->tree; print $tree->cell(0,0)->as_text;

      BTW, your test HTML is malformed (there's no closing <head> tag), but that doesn't affect the output of the script, at least on my machine...

        Still getting the same error with that script..