From 115cb64a6a4d43d610b034a8ded9f3db23cdcd83 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=20Ankarstr=C3=B6m?= Date: Sat, 8 May 2021 22:59:23 +0200 Subject: Add news.gmane.io as fallback for nntp.perl.org --- run/p5p | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/run/p5p b/run/p5p index 364af9c..165ad43 100755 --- a/run/p5p +++ b/run/p5p @@ -5,8 +5,19 @@ use warnings; use Net::NNTP; use HTML::Entities; -my $nntp = Net::NNTP->new('nntp.perl.org', Timeout => 10) or die "Cannot contact nntp.perl.org: $!"; -my ($count, $first, $last) = $nntp->group('perl.perl5.porters'); +my %alt = ( + 'nntp.perl.org' => 'perl.perl5.porters', + 'news.gmane.io' => 'gmane.comp.lang.perl.perl5.porters', +); + +my ($nntp, $count, $first, $last); +for my $server (keys %alt) { + $nntp = Net::NNTP->new($server, Timeout => 10) + or next; + ($count, $first, $last) = $nntp->group($alt{$server}); + last; +} +die "Cannot retrieve news: $!" if not $nntp; my %d = %{$nntp->xhdr('Date', [$last-10, $last])}; my %f = %{$nntp->xhdr('From', [$last-10, $last])}; -- cgit v1.2.3