#!@@Perl@@ -w =head1 NAME p4tkd - Run tkdiff with $P4CLIENT set =head1 SYNOPSIS p4tkd I =head1 DESCRIPTION If the current client (as reported by B) is known to the Perforce database, then the P4CLIENT environment variable is set to its name, and B is run with I as its arguments. Otherwise, an error is printed. This is convenient if you set the client name via a $P4CONFIG file. =head1 CAVEATS =over 2 =item * Requires the C module, which requires the C module, which is bundled with the C module. =back =head1 SEE ALSO =over 2 =item * tkdiff (http://www.accurev.com/free/tkdiff/) =back =cut use strict; use P4; my $p4=new P4; my $client=$p4->GetClient(); $p4->Init() || die("Failed to connect to Perforce Server"); my @info=$p4->Info(); $p4->Final(); my $valid; for (@info) { if(/^Client root:\s+/) { $valid=1; last; } } if($valid) { $ENV{'P4CLIENT'}=$client; exec('@@Tkdiff@@', @ARGV) || die("Failed to exec tkdiff because $!"); } else { die("Client \"$client\" is unknown.\n"); }