turning keep_html on kills results

Collin Peters <[email protected]> Sun, 29 Jan 2006 15:47:51 -0800
Newsgroups gmane.comp.lang.perl.modules.html-tableextract
Message-ID <[email protected]>
I have the following script to download some hockey stats from
espn.com.  Using HTML::TableExtract (2.06) when I set keep_html =3D> 1
then I do not get any results.  If I use keep_html =3D> 0 then I do get
results.  Am I missing something?  I could have sworn this used to
work for me so I am pulling my hair out.  Also, why does 'qw(PLAYER G
A)' return 4 tables in this screen (two tables that start with 'PLAYER
G A' and two that start with 'PLAYER SA GA'

-------------

#!/usr/bin/perl
use strict;

use HTML::TableExtract;
use LWP::Simple;
use LWP::UserAgent;

# Download content
my $url =3D "http://sports.espn.go.com/nhl/boxscore?gameId=3D251005030";
print "Downloading content from '$url'...";

my $ua =3D LWP::UserAgent->new;
#$ua->timeout(10);
#$ua->env_proxy;
#$ua->agent('Mozilla/5.0');

my $response =3D $ua->get($url);
print "done\n";

if ($response->is_success) {
    my $content =3D $response->content;

    my $te =3D HTML::TableExtract->new( headers =3D> [qw(PLAYER G A)],
slice_columns =3D> 0, keep_html =3D> 0 );
    $te->parse($content);

    # Examine all matching tables
    foreach my $ts ($te->tables) {
        print "Table (", join(',', $ts->coords), "):\n";
        foreach my $row ($ts->rows) {
            print join(',', @$row), "\n";
        }
    }
}


-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642