in reply to HTML::TableExtract (parse table column from an HTML page)

Probably something like:
my $te = HTML::TableExtract->new(depth => 0); $te->parse($content); my $table = $te->first_table_found; my $tree = $table->tree; print $tree->cell(2,2);
-David

Replies are listed 'Best First'.
Re^2: HTML::TableExtract (parse table column from an HTML page)
by cafaro (Novice) on Oct 07, 2007 at 11:23 UTC
    That isn't working either. This is the error I receive: "Can't call method "tree" on unblessed reference"
      That's straight from the documentation, so it probably can't find a table in the HTML source you've given it.

      -David

        I made a local HTML test page to be parsed with my Perl script, this is my Perl code:
        #!/usr/bin/perl use WWW::Mechanize; use HTML::TableExtract; sub parse { $mech = WWW::Mechanize->new(autocheck => 1); $mech->get("file:///home/cafaro/omertascript/test.html"); $content = $mech->content(); $te = HTML::TableExtract->new(depth => 0); $te->parse($content); $table = $te->first_table_found; $tree = $table->tree; print $tree->cell(0,0); } parse();
        ... and this is my HTML code:
        <html> <head> <title>test page</title> <head> <body> <table> <tr><td>parse me</td></tr> </table> </body> </html>