in reply to Re^8: HTML::TableExtract (parse table column from an HTML page)
in thread HTML::TableExtract (parse table column from an HTML page)
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...
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^10: HTML::TableExtract (parse table column from an HTML page)
by cafaro (Novice) on Oct 08, 2007 at 15:25 UTC | |
by Not_a_Number (Prior) on Oct 08, 2007 at 20:22 UTC | |
by cafaro (Novice) on Oct 10, 2007 at 15:51 UTC | |
by erroneousBollock (Curate) on Oct 14, 2007 at 06:17 UTC | |
by Not_a_Number (Prior) on Oct 10, 2007 at 21:06 UTC |