use strict; use warnings; use XML::Feed; use MIME::Lite; use DateTime; use URI; my $uri = URI->new("http://news.google.com/news?q=perl&output=atom"); # parse can take raw xml, file names, and more my $feed = XML::Feed->parse($uri) or die XML::Feed->errstr; my $last_48 = DateTime ->now( time_zone => 'floating' ) ->subtract( hours => 48 ); exit unless 1 == DateTime->compare( $feed->modified, $last_48 ); my $body = ""; for my $entry ( $feed->entries ) { next unless 1 == DateTime->compare( $entry->modified, $last_48 ); $body .= "

" . $entry->title . "

\n"; $body .= "
" . $entry->content->body . "
\n"; } warn "No body... loves me!" unless $body; my $msg = MIME::Lite ->new( From => 'me@myhost.com', To => 'you@yourhost.com', Subject => $feed->title, Type => "text/html", Data => $body, ); print $msg->as_string, "\n"; # $msg->send;