Skip Menu |

This queue is for tickets about the HTML-TableExtract CPAN distribution.

Report information
The Basics
Id: 34726
Status: resolved
Priority: 0/
Queue: HTML-TableExtract

People
Owner: MSISK [...] cpan.org
Requestors: ion [...] comsil.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: error in table extract sample code
Date: Mon, 7 Apr 2008 04:18:38 +0800
To: bug-HTML-TableExtract [...] rt.cpan.org
From: davidt <ion [...] comsil.com>
I think i found a bug in the example of HTML Extract... http://search.cpan.org/~msisk/HTML-TableExtract-2.10/lib/HTML/TableExtract.pm#SYNOPSIS Should it just be " $te->parse($html_file);" # Example: Using depth and count information. # Every table in the document has a unique depth and count tuple, so # when both are specified it is a unique table. Depth and count both # begin with 0, so in this case we are looking for a table (depth 2) # within a table (depth 1) within a table (depth 0, which is the top # level HTML document). In addition, it must be the third (count 2) # such instance of a table at that depth. $te = HTML::TableExtract->new( depth => 2, count => 2 ); $te->parse_file($html_file); foreach $ts ($te->tables) { print "Table found at ", join(',', $ts->coords), ":\n"; foreach $row ($ts->rows) { print " ", join(',', @$row), "\n"; } }
This usage is technically correct -- H::TE follows the HTML::Parse way of things, which includes several parsing methods including parse() (takes html string) and parse_file() (takes file name). The example code could be a bit more clear about that, however, so I'll make sure and make it more explicit in the next release. Thanks for the feedback, Matt