Aldebaran has asked for the wisdom of the Perl Monks concerning the following question:
Hello Monks,
I find a natural intersection between skywatching and programming, because I'm always curious about when beautiful events happen *exactly*. So it is that I've been watching Venus and Jupiter close the distance on each other, awaiting their confluence some time in early July. I'd like to use perl to tell me where and when this "occultation" begins and ends. The site I'll draw my data from is given as a lexical variable in this script:
#!/usr/bin/perl -w use strict; use 5.010; use HTML::Treebuilder; #use HTML::TreeBuilder 5 -weak; # Ensure weak references in use my $site = "https://www.fourmilab.ch/yoursky/"; my $tree = HTML::TreeBuilder->new_from_url($site); $tree->parse_file($site); print "Hey, here's a dump of the parse tree of $site:\n"; $tree->dump; # a method we inherit from HTML::Element #print "And here it is, bizarrely rerendered as HTML:\n", $tree->as_HT +ML, "\n"; # Now that we're done with it, we must destroy it. $tree = $tree->delete; # Not required with weak references __END__
There's 2 things that I need to make happen in order to bring some numbers to bear on this endeavor. 1) I need to follow the link for "nearby city" and set it to "Portland, OR" and 2) I need to capture the ephemeris, which comes across as a table.
Another question at the get-go: what makes a weak reference different and why might I want that over what I have?
Thanks for your comment,
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Using HTML::Treebuilder effectively to capture data
by choroba (Cardinal) on Jun 16, 2015 at 10:10 UTC | |
by FryingFinn (Beadle) on Jun 16, 2015 at 18:47 UTC | |
by Aldebaran (Curate) on Jun 18, 2015 at 05:02 UTC | |
by choroba (Cardinal) on Jun 18, 2015 at 10:46 UTC | |
|
Re: Using HTML::Treebuilder effectively to capture data
by pme (Monsignor) on Jun 16, 2015 at 09:51 UTC |