# 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/NT using perl 5.6 with p4perl API # # room for optimization/improvement: add getopts call # # Copyright 2004 Perforce Corporation, Inc. All rights reserved. use P4; my $p4 = new P4; $p4->ParseForms(); $p4->Init() or die "Failed to initialize 'p4' object!"; $p4->Tagged(); #----------------------------------------------------------- # first call to P4: 'p4 users' #----------------------------------------------------------- @ret = $p4->Users(); %userHash = {}; foreach $u (@ret) { $userName = $u->{'User'}; $userHash{$userName} = $u; } #----------------------------------------------------------- # second call to P4: 'p4 clients' #----------------------------------------------------------- @ret = $p4->Clients(); 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"; } }