Subj : NNRP tally script To : All From : James Vahn Date : Sun Jun 03 2001 08:44 am Just for fun :-) Fido is located on a private news server here, this script uses Net:NNTP to gather stats for the target echo. Stats for "fido.perl" Number of messages: 25 First message: 953 Last message: 977 Scanning echo, beginning with message #953 Posts: Name and address: ---------------------------------------------------------- 5 tony summerfelt 1 Maurice Kinal 2 Maurice Kinal 7 Jame Clay 5 Jame Clay 5 Russ Johnson __BEGIN__ #!/usr/bin/perl -w # # stats.pl - Program to generate echo stats and poster totals. # James Vahn 1:346/3, jvahn@short.circuit.com # June 3, 2001 # use strict; use Net::NNTP; my $host = "gonzo.bbs"; my $group = "fido.perl"; my $user = "jvahn"; my $pass = "secretpassword"; my $home = "/home/jvahn"; my ($cnt, $i, %name, $msg, $nntp, @list); $nntp = Net::NNTP->new($host, Debug=>0); if ($user) { $nntp->authinfo($user, $pass); } $nntp->reader; @list = $nntp->group("$group"); print "\nStats for \"$group\"\n"; print " Number of messages: $list[0]\n"; print " First message: $list[1]\n"; print " Last message: $list[2]\n\n"; # .statsrc contains the last message number, as a starting point. # if (-e "$home/.statsrc.$group") { open (CNT, "< $home/.statsrc.$group"); $cnt = ; chomp $cnt; close CNT; } else { $cnt = $list[1] - 1 } # no .statsrc found, assuming "all". if ($cnt < 0) { $cnt = $list[2] + $cnt }; open (CNT, "> $home/.statsrc.$group"); print CNT "$list[2]\n"; close CNT; $cnt++; print "Scanning echo, beginning with message \#$cnt\n"; for ($i=$cnt ; $i<=$list[2] ; $i++) { foreach (@{$nntp->head($i)}) { # if (/^From:.*<(.*)?\>/) { # strip names if (/^From:(.*)?/) { # keep names if (! $name{$1}) { $name{$1} = 0 } $name{$1} += 1 ; } } } print "Posts: Name and address:\n"; print "----------------------------------------------------------\n"; foreach $msg (keys %name) { printf "%5d %s\n", $name{$msg}, $msg; } print "\n"; $nntp->quit; __END__ --- Debian GNU/Linux * Origin: 300 miles East (1:346/3) .