RSS | Module Info | Add a review of HTML-TableParser

HTML-TableParser (0.38) ****

- doesnt handle "flipped" tables (th's on rows not columns)

- MultiMatch should be the default

w george - 2009-05-15 09:15:30
Was this review helpful to you?  Yes No

1 out of 1 found this review helpful:

HTML-TableParser (0.38) *****

About as close as possible to a perfect Do-What-I-Mean solution to an otherwise painful, complicated, process.

Anirvan Chatterjee - 2009-02-03 12:22:59
Was this review helpful to you?  Yes No

HTML-TableParser (0.34) ****

this is a good module to retrive data in HTML table~~~
the following is a sample program to get weather forecast from
http://tw.weather.yahoo.com/tomorrow.html
and print the result to stdout.


use LWP::UserAgent;
use HTTP::Request::Common;
use HTML::TableParser;

#
# get web page http://tw.weather.yahoo.com/tomorrow.html
#

$ua = LWP::UserAgent->new;
$res = $ua->request(GET 'http://tw.weather.yahoo.com/tomorrow.html');

@content = split "\n", $res->as_string;

foreach (@content){
if(/^(民國.*)/){
print $_, "\n\n";
}
}

#
# reference
# http://search.cpan.org/~djerius/HTML-TableParser-0.34/TableParser.pm
#

@reqs = (
{
id => 5.1, # id for embedded table
row => \&row, # function callback
}
);

# create parser object
$p = HTML::TableParser->new( \@reqs,
{ Decode => 0, Trim => 0, Chomp => 0 } );
$p->parse($res->as_string);
# function callbacks

sub row {
my ( $id, $line, $cols, $udata ) = @_;

print join "\t", @$cols;
print "\n";

}

macarthur - 2004-08-21 09:05:55
Was this review helpful to you?  Yes No


the camel