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,


In reply to Using HTML::Treebuilder effectively to capture data by Aldebaran

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.