List Info

Thread: how to add views to a client




how to add views to a client
user name
2006-08-02 14:49:25
The View is an array reference. Try...
 
$client = $p4->FetchClient("SumanWin");
my $view = $client->{ 'View' };
push( {$view}, "//depot/automation//device/... //SumanWin/suman/..." );
$p4->SaveClient("SumanWin");
 ;
Later.....Scott...

-----Original Message-----
From: p4perl-bouncesperforce.com [mailto:p4perl-bouncesperforce.com]On Behalf Of mehta suman
Sent: Wednesday, August 02, 2006 10:18 AM
To: p4perlperforce.com
Subject: [p4perl] how to add views to a client

How can I add view to client dynamically. I am using following code to do this. But thi s isn't working.
 
 
$client = $p4->FetchClient("SumanWin");
$client->{'View'} = "//depot/automation//device/... //SumanWin/suman/...";
$p4->SaveClient($client);

foreach my $e ( $p4->Errors() )
{
printf( "ERROR: %s\n", $e );
}
 
Thanks
Suman


Yahoo! Messenger with Voice. Make PC-to-Phone Calls to the US (and 30+ countries) for 2¢/min or less.
how to add views to a client
user name
2006-08-03 04:34:14
I tried the code you sent but unfortunately that didn't work,
$clientView = "Suman";
 
$client = $p4->FetchClient($clientView);
my $view = $client->{ 'View' };
push( {$view}, "//depot/automation/device/... //".$clientView."/suman1/..." );
$p4->;SaveClient($clientView);
$count = $p4->ErrorCount();
errors = $p4->Errors();
if ($count > 0)
{
print($errors[0], "\n" );
}
 
Error I get is
 
Error in client specification.
Error detected at line 1.
Syntax error in 'Suman'.
 
What should I do while saving the client.
$p4->SaveClient($client); or $p4->SaveClient("Suman");
 
Actually if I use $p4->SaveClient($client);  then I don't get any error but view is not updated.
 
-Suman
Scott Lavender <scott.lavendervisiprise.com> wrote:
The View is an array reference. Try...
 
$client = $p4->FetchClient("SumanWin");
my $view = $client-&gt;{ 'View' };
push( {$view}, "//depot/automation//device/... //SumanWin/suman/..." );
$p4->SaveClient("SumanWin");
 ;
Later.....Scott...

-----Original Message-----
From: p4perl-bouncesperforce.com [mailto:p4perl-bouncesperforce.com]On Behalf Of mehta suman
Sent: Wednesday, August 02, 2006 10:18 AM
To: p4perlperforce.com
Subject: [p4perl] how to add views to a client

How can I add view to client dynamically. I am using following code to do this. But thi s isn't working.
 
 
$client = $p4->FetchClient("SumanWin");
$client-&gt;{'View'} = "//depot/automation//device/... //SumanWin/suman/...";
$p4->SaveClient($client);

foreach my $e ( $p4->Errors() )
{
printf( "ERROR: %s\n", $e );
}
 
Thanks
Suman

Yahoo! Messenger with Voice. Make PC-to-Phone Calls to the US (and 30+ countries) for 2¢/min or less.


Do you Yahoo!?
Next-gen email? Have it all with the all-new Yahoo! Mail Beta.
how to add views to a client
user name
2006-08-04 12:31:45
Here's a piece of code that you can insert in your program
to see what the client view looks like before you try the
p4::SaveClient. I have it in another program of mine, and
found it useful for debugging purposes. It might point out
the problem in your client specification and why it is
getting rejected.
 
my %myHash = %{$client};
ztagRead("client", "nbk6n2b",
\%myHash);
 
foreach my $key (keys(%myHash)) {
    if (ref($myHash{"$key"}) eq
"ARRAY") {
        my myArray = {$myHash{"$key"}};
        for(my $entry = 0; $entry <= $#myArray; $entry++)
{
            print qq(DEBUG:
\$myHash{"$key"}->[$entry] =
"$myArray[$entry]"\n);
        }
    } else {
        print qq(DEBUG: \$myHash{"$key"} =
"$myHash{$key}\n");
    }
}

The output will look something like this:

$myHash{"Root"} =
"/home/nbk6n2b/bin"
$myHash{"Options"} = "noallwrite noclobber
nocompress unlocked nomodtime normdir"
$myHash{"View"}->[0] = "//spec/...
//nbk6n2b/spec/..."
$myHash{"View"}->[1] = "//depot/...
//nbk6n2b/depot/..."
$myHash{"Owner"} = "nbk6n2b"
$myHash{"LineEnd"} = "local"
$myHash{"Client"} = "nbk6n2b"
$myHash{"Host"} = "scsefpsdcs01"
$myHash{"Description"} = "Created by
nbk6n2b."

Note that $myHash{"View"} is an array in the
hash %myHash. Also note that the fields are not in the same
order of the form (this can be expected).

________________________________

	From: p4perl-bouncesperforce.com [mailto:p4perl-bouncesperforce.com] On Behalf Of mehta suman
	Sent: Thursday, August 03, 2006 12:34 AM
	To: Scott Lavender; p4perlperforce.com
	Subject: Re: [p4perl] how to add views to a client
	
	
	I tried the code you sent but unfortunately that didn't
work,
	$clientView = "Suman";
	 
	$client = $p4->FetchClient($clientView);
	my $view = $client->{ 'View' };
	push( {$view}, "//depot/automation/device/...
//".$clientView."/suman1/..." );
	$p4->SaveClient($clientView);
	$count = $p4->ErrorCount();
	errors = $p4->Errors();
	if ($count > 0)
	{
	print($errors[0], "\n" );
	}
	
	 
	Error I get is 
	 
	Error in client specification.
	Error detected at line 1.
	Syntax error in 'Suman'.
	 
	What should I do while saving the client. 
	$p4->SaveClient($client); or
$p4->SaveClient("Suman");
	 
	Actually if I use $p4->SaveClient($client);  then I
don't get any error but view is not updated.
	 
	-Suman
	Scott Lavender <scott.lavendervisiprise.com> wrote:

		The View is an array reference. Try...
		 
				$client = $p4->FetchClient("SumanWin");
		my $view = $client->{ 'View' };
		push( {$view}, "//depot/automation//device/...
//SumanWin/suman/..." );
		$p4->SaveClient("SumanWin");
		 
		Later.....Scott...

		
			-----Original Message-----
			From: p4perl-bouncesperforce.com [mailto:p4perl-bouncesperforce.com]On Behalf Of mehta suman
			Sent: Wednesday, August 02, 2006 10:18 AM
			To: p4perlperforce.com
			Subject: [p4perl] how to add views to a client
			
			
			How can I add view to client dynamically. I am using
following code to do this. But thi s isn't working.
			 
			 
			$client = $p4->FetchClient("SumanWin");
			$client->{'View'} =
"//depot/automation//device/...
//SumanWin/suman/...";
			$p4->SaveClient($client);
			
			foreach my $e ( $p4->Errors() )
			{
			printf( "ERROR: %s\n", $e );
			}
			 
			Thanks
			Suman
________________________________

			Yahoo! Messenger with Voice. Make PC-to-Phone Calls
<ht
tp://us.rd.yahoo.com/mail_us/taglines/postman1/*http://us.rd
.yahoo.com/evt=39663/*http://voice.yahoo.com>  to the
US (and 30+ countries) for 2¢/min or less.


	________________________________

	Do you Yahoo!?
	Next-gen email? Have it all with the all-new Yahoo! Mail
Beta. <http://us.rd.yahoo.com/evt=
42241/*http://advision.webevents.yahoo.com/handraisers>  

_______________________________________________
p4perl mailing list
p4perlperforce.com

http://maillist.perforce.com/mailman/listinfo/p4perl
[1-3]

about | contact  Other archives ( Real Estate discussion Medical topics )