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/p5p | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 run/p5p (limited to 'run/p5p') diff --git a/run/p5p b/run/p5p new file mode 100644 index 0000000..ebb0c62 --- /dev/null +++ b/run/p5p @@ -0,0 +1,31 @@ +#!/usr/bin/perl + +use strict; +use warnings; +use Net::NNTP; +use HTML::Entities; + +my $nntp = Net::NNTP->new('nntp.perl.org') or die "Cannot contact nntp.perl.org: $!"; +my ($count, $first, $last) = $nntp->group('perl.perl5.porters'); + +my %d = %{$nntp->xhdr('Date', [$last-10, $last])}; +my %f = %{$nntp->xhdr('From', [$last-10, $last])}; +my %s = %{$nntp->xhdr('Subject', [$last-10, $last])}; + +# TODO: Escape potential HTML characters + +for ((reverse sort keys %d)[0..4]) { + $_ = encode_entities($_) for ($d{$_}, $f{$_}, $s{_}); + $f{$_} =~ s,@[^.]*\.,@hidden.,; + print < +
+Date: $d{$_} +
From: $f{$_} +
+Subject: $s{$_} +

+HTML +} + +$nntp->quit; -- cgit v1.2.3