[p4perl] Help creating client workspace from template

Nathan_Tran at trendmicro.com Nathan_Tran at trendmicro.com
Thu Apr 26 09:21:02 PDT 2007


Hi Tony,

That worked perfectly. Thanks for the quick help.

Regards,
Nathan


-----Original Message-----
From: Tony Smith [mailto:tony at smee.org] 
Sent: Thursday, April 26, 2007 7:46 AM
To: p4perl at perforce.com
Cc: Nathan Tran (RD-US)
Subject: Re: [p4perl] Help creating client workspace from template

Hi Nathan,


> I have the following code that uses an existing client workspace
> template to create a new client workspace. The client workspace seems
to
> get created by the options and view mappings from the template are not
> preserved in the new client workspace. Here's a snipet of the code:

I think the problem is that you're not saving the output of the 'p4 
client -o -t template client' command below:

> $p4->Run("client", "-o", "-t", $client_template, $client_name);

That command probably produces almost exactly what you want, but your
script 
discards it and then tries to recreate its effects, unsuccessfully.

> Does anyone have some code sample to create a new client workspace
based
> on an existing template?

Try:

	my $spec = $p4->FetchClient( "-t", $template, $clientName );
	$spec->{ 'Root' } = $clientRoot;
	$p4->SaveClient( $spec );

Obviously the variables used will need to be initialised, but that
should do 
the trick.

Tony

TREND MICRO EMAIL NOTICE
The information contained in this email and any attachments is confidential and may be subject to copyright or other intellectual property protection. If you are not the intended recipient, you are not authorized to use or disclose this information, and we request that you notify us by reply mail or telephone and delete the original message from your mail system.




More information about the p4perl mailing list