diff options
Diffstat (limited to 'run/p5p')
-rw-r--r-- | run/p5p | 31 |
1 files changed, 31 insertions, 0 deletions
@@ -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,@[^.]*\.,@<i>hidden</i>.,; + print <<HTML; +<p> +<div style="font-size: 80%; margin: 0;"> +<span class="date" style="line-height: 1;">Date: $d{$_}</span> +<br/><span class="from">From: $f{$_}</span> +</div> +<span class="subject">Subject: <a href="https://www.nntp.perl.org/group/perl.perl5.porters/0/0/msg$_.html">$s{$_}</a></span> +</p> +HTML +} + +$nntp->quit; |