nntp

Fetching available newsgroups from a news server

This script fetches a list of available newsgroups (and descriptions) from a news server. The group list is returned as a hashref where the keys are the groupname and the value is a description of the group. #!/usr/bin/perl -w use strict; use Net::NNTP; use MIME::Base64 qw(decode\_base64); use MIME::QuotedPrint qw(decode\_qp); my $server= "sunsite.auc.dk"; print STDERR "connecting to $server... "; my $nntp= Net::NNTP->new($server); unless($nntp) { print STDERR "failedn"; exit 1; } print STDERR "okn"; print STDERR "getting messages.

Fetching recent headlines from a news server

The followig piece connects to a news-server and fetches subjects from the last week in a specific newsgroup (the Danish perl-newsgroup) and prints these. #!/usr/bin/perl -w use strict; use Net::NNTP; use MIME::Base64 qw(decode\_base64); use MIME::QuotedPrint qw(decode\_qp); my $server= "sunsite.auc.dk"; print STDERR "connecting to $server... "; my $nntp= Net::NNTP->new($server); unless($nntp) { print STDERR "failedn"; exit 1; } print STDERR "okn"; print STDERR "getting messages... "; my $newstuff= $nntp->newnews(time - 7\*24\*2600, "dk.