#!/usr/bin/perl -w
=pod
=head is_newsgroup
is_newsgroup 'comp.lang.perl.*'
=head1 DESCRIPTION
B<is_newsgroup> contacts your newsserver and prints all newsgroups
whose names match the pattern specified, along with the number of
messages in each group.
=head1 AUTHOR
Gossamer <
[email protected]>
=head1 PREREQUISITES
Net::NNTP
=head1 SCRIPT CATEGORIES
News
=cut
#
use strict;
use Net::NNTP;
my $VERSION = "1.0";
my $newsserver = "news.glasswings.com.au";
#
# Main
#
my $pattern = $ARGV[0];
print "Searching for '$pattern' ...\n";
my $nntp = Net::NNTP->new($newsserver);
my %groups = %{ $nntp->active($pattern) };
if (%groups) {
foreach (sort keys %groups) {
my $highmsg = $groups{$_}[0];
my $lowmsg = $groups{$_}[1];
my $diff = $highmsg - $lowmsg;
print "$_ ($diff messages)\n";
}
} else {
print "(none found)\n";
}
$nntp->quit;
exit;
#
# End.
#