dcb0127 has asked for the wisdom of the Perl Monks concerning the following question:

#!/usr/bin/perl -w use lib qw( ..); use HTML::TableExtract; use LWP::Simple; use Data::Dumper; my $te = new HTML::TableExtract( depth=>3, count=>0, gridmap=>0); my $content = get("http://www.computerjobs.com"); $te->parse($content); foreach $ts ($te->table_states) { foreach $row ($ts->rows) { print Dumper $row; # print Dumper $row if (scalar(@$row) == 2); } }
Code above continues to give me an error message: Use of uninitialized value in subroutine entry at table.pl line 12 How do I go about just getting some code that'll extract information from a html table within a table.

Replies are listed 'Best First'.
Re: HTML::TableExtract
by Solo (Deacon) on Sep 16, 2002 at 17:35 UTC
    The error indicates that $content is undef. Perhaps you need to configure LWP to use a proxy?

    The following excerpt is from the lwpcook POD:

    use LWP::UserAgent; $ua = LWP::UserAgent->new; $ua->env_proxy; # initialize from environment variables # or $ua->proxy(ftp => 'http://proxy.myorg.com'); $ua->proxy(wais => 'http://proxy.myorg.com'); $ua->no_proxy(qw(no se fi)); my $req = HTTP::Request->new(GET => 'wais://xxx.com/'); print $ua->request($req)->as_string;
    (Update: added excerpt from lwpcook)
    --
    May the Source be with you.

    You said you wanted to be around when I made a mistake; well, this could be it, sweetheart.

      Thanks the get is working now
Re: HTML::TableExtract
by Aristotle (Chancellor) on Sep 16, 2002 at 17:36 UTC
    The code runs fine for me. Line 12 is $te->parse($content); which means $content is undefined, ie empty. Obviously your get("http://www.computerjobs.com") is failing for some reason.

    Makeshifts last the longest.