Quicksilver has asked for the wisdom of the Perl Monks concerning the following question:
All I'm trying to get is the description as it contains all the necessary information I need. MTIA for any help.use strict; use warnings; use LWP::Simple; use LWP::UserAgent; use XML::LibXML; my $DIR = "C:\\Webroot\\rdf"; my $from = 'me'; my $to = 'me'; my $subject = "tweeting annoying"; my $ticket = qw(localhost/rss); my @news = ("localhost/rss", => "TestList",); chdir $DIR or die "Cannot chdir $DIR: $!"; my @output; while (@news >= 2) { my ($url, $localname) = splice @news, 0, 2; dbmopen my %SAW, $localname, 0644 or warn "Cannot open %SAW for $lo +calname: $!"; my $feed = get($ticket); my $parser = XML::LibXML->new; my $doc = $parser->parse_string($feed); my %seen; my @item_output; for my $item($doc) { my $date = $doc->findvalue('rss/channel/item/pubDate'); my $desc = $doc->findvalue('rss/channel/item/description'); $seen{$date} = localtime; next if $SAW{$date}; push @item_output, $desc; } %SAW = %seen; if (@item_output) { push @output, @item_output; } } if (@output) { require Net::SMTP; my $smtp = Net::SMTP->new(Host => 'mailhost'); $smtp->mail( $from ); $smtp->to( $to ); $smtp->data(); $smtp->datasend("To: $to\n"); $smtp->datasend("From: $from\n"); $smtp->datasend("Subject: $subject\n"); $smtp->datasend("\n"); # done with header $smtp->datasend("@output\n"); $smtp->dataend(); $smtp->quit(); # all done. message sent. }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Automating an RSS feed
by davorg (Chancellor) on Aug 06, 2008 at 17:09 UTC | |
by Quicksilver (Scribe) on Aug 07, 2008 at 07:33 UTC | |
|
Re: Automating an RSS feed
by Your Mother (Archbishop) on Aug 06, 2008 at 23:52 UTC | |
by davorg (Chancellor) on Aug 07, 2008 at 08:54 UTC | |
by Quicksilver (Scribe) on Aug 07, 2008 at 13:21 UTC |