# Don't specify a user/password here. $p4 = "p4 -p 1666"; # Usage: # requirePW form-in group "perl pw_group.pl %formfile%" my $formfile = $ARGV[0]; die "incorrect trigger usage!" if ( !$formfile ); my @result; open FILE, $formfile or die "couldn't open file: $!"; while ( ) { if ( !/^[\s]+/ ) { push @result, $_; next; } if ( !/[\S]/ ) { push @result, $_; next; } s/[\s]+//g; $user = $_; $_ = `$p4 -u $user -P $user -c noemail changes -m1 2>&1`; if ( !/^Change/ ) { push @result, "\t".$user."\n"; next; } print "Dropped $user from group due to lack of password.\n"; $dropped = 1; } close FILE; exit if ( !$dropped ); open FILE, '>', $formfile or die "couldn't open file: $!"; foreach( @result ) { print FILE $_; } close FILE;