Something along the lines of this?:
-CW
--------------------------------------------------
#!/usr/bin/perl
# enter a site maintainer email address & password below
my @lists = qw/list1 list2/;
my $adminemail = '';
my $adminpw = '';
my %list1members;
my %list2members;
# === PROGRAM ==========================================
foreach $list (@lists) {
my $command = "QUERY ***GUI*** $list for *\@*";
# send TCPGUI command
$return = lsvsend("$command");
@ret_lines = split /\n/, $return;
foreach $line (@ret_lines) {
chomp($line);
if ($line =~ m/^\*\*\*HDR\*\*\*/) {
($hdr, $email) = split / /, $line;
${$list}members{$email} = 1;
}
}
}
# print results!
foreach $user (sort(keys(%list1members))) {
if (defined($list2members{$user})) {
print "$user\n";
}
}
# === SUBROUTINE ========================================
# Send TCPGUI commands to LISTSERV as administrator
sub lsvsend {
my($cmd) = @_;
my $email = $adminemail;
$cmd .= " PW=$adminpw";
# --- Connect to Listserv --- #
use IO::Socket;
my $lsv = IO::Socket::INET->new(
Proto => "tcp",
PeerAddr => "localhost",
PeerPort => '2306')
or die return "Error connecting to Listserv: $!";
# --- Send Command --- #
# form binary part of command header
my $len = length($email)+length($cmd)+1;
my $bin =
pack("a*CCCa*","\r\n",int($len/256),$len-(int($len/256)*256),length($email),$email);
# send command header
print $lsv "1B".$bin;
recv($lsv, my $ans, 80, 0);
if($ans !~ /^250/){
return "Error sending command to Listserv: $ans";
}
# followed by command itself
print $lsv "$cmd\n";
# --- Get Reply --- #
# get binary part of reply & decode
read($lsv, $ans, 8);
my @an = $ans =~ /.{4}/g;
my $rcode = unpack("N", $an[0]);
my $rlen = unpack("N", $an[1]);
if($rcode != 0){
return "Error getting reply from Listserv: $rcode (len
$rlen)";
}
# and get reply itself
read($lsv, my $reply, $rlen);
close $lsv; # close socket
return $reply;
}
----------------------------------------------------
Winship wrote:
> At one site I have two lists. I would like to quickly see what addresses
> are subscribed to both lists. Is there a way to do it?
>
> Douglas Winship [log in to unmask]
--
Christopher Wilson
Information Systems Coordinator
ISS Enterprise Systems
The George Washington University
[log in to unmask]
|