# Task: compare client specs to users, and flag the # client specs owned by users that don't exist anymore. # # num of calls to 'p4': 2 # status: tested on Win/2000 using perl 5.6 # # room for optimization/improvement: add getopts call # # Copyright 2004 Perforce Corporation, Inc. All rights reserved. require "ztag.pl"; $p4 = "p4 -Ztag -u zaphod"; #----------------------------------------------------------- # first call to P4: 'p4 users' #----------------------------------------------------------- $client_tagged_cmd = "$p4 users"; @ret = readinZtag($client_tagged_cmd); %userHash = {}; foreach $u (@ret) { $userName = $u->{'User'}; $userHash{$userName} = $u; } #----------------------------------------------------------- # second call to P4: 'p4 clients' #----------------------------------------------------------- $client_tagged_cmd = "$p4 clients"; @ret = readinZtag($client_tagged_cmd); foreach $c (@ret) { $clientName = $c->{'client'}; $clientOwner = $c->{'Owner'}; if (defined($userHash{$clientOwner})) { print "$clientName owned by $clientOwner OK\n"; } else { print "$clientName owned by $clientOwner ** unknown user **\n"; } }