aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Ankarström <john@ankarstrom.se>2021-05-08 22:59:23 +0200
committerJohn Ankarström <john@ankarstrom.se>2021-05-08 22:59:46 +0200
commit115cb64a6a4d43d610b034a8ded9f3db23cdcd83 (patch)
tree72c6f57295fe87fa34aff1411926c30c01239a5a
parentb37fe9bed32a78bbe43ba2c152989d34f051ef85 (diff)
downloadperlisdead-115cb64a6a4d43d610b034a8ded9f3db23cdcd83.tar.gz
Add news.gmane.io as fallback for nntp.perl.org
-rwxr-xr-xrun/p5p15
1 files 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])};