diff options
-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])}; |