<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">#!/usr/bin/perl -w
=pod

=head is_newsgroup

     is_newsgroup 'comp.lang.perl.*'

=head1 DESCRIPTION

  B&lt;is_newsgroup&gt; 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 &lt;gossamer@tertius.net.au&gt;

=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-&gt;new($newsserver);

my %groups = %{ $nntp-&gt;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-&gt;quit;

exit;
#
# End.
#
</pre></body></html>