From d514585bbb54482ee62070bc86a7447a657afaee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=20Ankarstr=C3=B6m?= Date: Thu, 6 May 2021 14:30:32 +0200 Subject: First commit --- run/rss | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 run/rss (limited to 'run/rss') diff --git a/run/rss b/run/rss new file mode 100644 index 0000000..2dfb60f --- /dev/null +++ b/run/rss @@ -0,0 +1,34 @@ +#!/usr/bin/perl + +use strict; +use warnings; + +use HTML::Entities; +use XML::Feed; +use Encode qw(decode encode); + +my %feeds = ( + blogs => 'http://blogs.perl.org/atom.xml', + reddit => 'https://www.reddit.com/r/perl/.rss', + cpan => 'https://metacpan.org/feed/recent', +); +(my $name = $0) =~ s,.*/,,; + +my $feed = XML::Feed->parse(URI->new($feeds{$name})) + or die XML::Feed->errstr; +my @entries = $feed->entries; + +# Print summary of five latest entries +for my $entry (@entries[0..4]) { + my $d = encode_entities $entry->issued->ymd; + my $f = encode_entities decode('utf8', $entry->author); + my $s = encode_entities decode('utf8', $entry->title); + my $l = encode_entities $entry->link; + print < +
$d
+
$f
+
$s
+ +HTML +} -- cgit v1.2.3