#! /usr/bin/perl use warnings; use strict; use 5.010; use WWW::Mechanize::GZip; use HTML::TableExtract qw(tree); my $site = 'http://www.fourmilab.ch/yoursky/cities.html'; my $mech = 'WWW::Mechanize::GZip'->new; $mech->get($site); $mech->follow_link( text => 'Portland OR' ); my $lub = 2457204.63659; #least upper bound my $glb = 2457207.63659; #greatest lower bound say $mech->dump_forms; $mech->set_fields( qw'date 2'); my $guess = median( $lub, $glb); say "guess is $guess"; $mech->set_fields( jd => $guess ); $mech->click_button(value => "Update"); say $mech->dump_forms; my $te = 'HTML::TableExtract'->new; $te->parse($mech->content); my $table = ($te->tables)[3]; my $table_tree = $table->tree; my $table_text = $table_tree->as_text; say "table text is $table_text"; my $venus = $table_tree->cell(4,1)->as_text; say "say venus is $venus"; my $jupiter = $table_tree->cell(7,1)->as_text; say "say jupiter is $jupiter"; sub median{ my ($upper, $lower) = @_; my $return = ($upper+$lower)/2.0; return $return; }