Dear Monks,
I don't know if I'm going off on the wrong tanget here but I've been trying to come up with a short script that automates the fetching of two nodes in an RSS feed. What I'm aiming to do is to send any new items to Twitter (the code which I've already got working). I'm working on the way of making sure that I'm only fetching two (or any number) items and that they are new. I had thought of putting them nodes in a hash (as databasing them would be overkill) and comparing them but is there a better way of doing this and also how would I limit the number of items found as my previous attempts have failed dismally. I'm also limited by the packages on the server to these modules rather than being able to use XML::RSS and the $desc gives me some detail which my LWP::UA attempt stripped out (it has a hyperlink in it).
use strict; use warnings; use LWP::Simple; use XML::LibXML; my $tickets = qw(localhost/rss); my $feed = get($tickets); my $parser = XML::LibXML->new; my $doc = $parser->parse_string($feed); my $date = $doc->findvalue('rss/channel/item/pubDate'); my $desc = $doc->findvalue('rss/channel/item/description'); my %hash = ($date, $desc);
I'd be grateful for any pointers in the two issues.

In reply to Automating RSS fetching and comparing by Anonymous Monk

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.