diff options
author | John Ankarström <john@ankarstrom.se> | 2021-05-08 22:59:23 +0200 |
---|---|---|
committer | John Ankarström <john@ankarstrom.se> | 2021-05-08 22:59:46 +0200 |
commit | 115cb64a6a4d43d610b034a8ded9f3db23cdcd83 (patch) | |
tree | 72c6f57295fe87fa34aff1411926c30c01239a5a | |
parent | b37fe9bed32a78bbe43ba2c152989d34f051ef85 (diff) | |
download | perlisdead-115cb64a6a4d43d610b034a8ded9f3db23cdcd83.tar.gz |
Add news.gmane.io as fallback for nntp.perl.org
-rwxr-xr-x | run/p5p | 15 |
1 files changed, 13 insertions, 2 deletions
@@ -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])}; |