I'm attempting to use HTML::TableExtract to grab the contents of a table of data from an HTML source. I'm using the 'headers' method of finding the appropriate table within a nest of several tables. However, I've been unsuccessful so far in getting the following test-script to produce any output at all. This is troubling, since the snippet is almost verbatum taken from the Synopsis provided in the POD for the module in question.

use strict; use warnings; use LWP::Simple; use HTML::TableExtract; #my $page = get( 'http://www.garmin.com/support/download.jsp'); my $raw_html = do { open my $in, '<', 'garmin.htm' or die "Can't open infile: $!\n"; local $/ = undef; <$in>; }; my $te = new HTML::TableExtract( headers => ["Product Name", "Software Version", "Compatible with Versions +", "Date" ] ); $te->parse($raw_html); # Examine all matching tables foreach my $ts ( $te->table_states ) { print "Table (", join(',', $ts->coords), "):\n"; foreach my $row ( $ts->rows ) { print join( ',', @$row ), "\n"; } }

The table I'm trying to grab is found at http://www.garmin.com/support/download.jsp.

This is entirely for personal use, and not really all that important of a script. I already have a working version that uses regexes to pull the appropriate data and notify me if there's been an update to one of the particular devices I'm interested in, and even without that, Garmin has an email notification system in place. But I wanted to see if I could rewrite it using a more robust parser.

Any suggestions on where my snippet is failing to enable the module to find the table I'm searching for would be appreciated.


Dave


In reply to Using HTML::TableExtract by davido

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.