List Info

Thread: how to add views to a client




how to add views to a client
user name
2006-08-04 12:41:24
Thanks for that....

BTW, what module is 'ztagRead' part of. I can't seem to
find any docs on it...

-----Original Message-----
From: Weintraub, David [mailto:david.weintraubbofasecurities.com]
Sent: Friday, August 04, 2006 8:32 AM
To: mehta suman; Scott Lavender; p4perlperforce.com
Subject: RE: [p4perl] how to add views to a client


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
how to add views to a client
user name
2006-08-04 13:10:33
Oops!

That is my own P4 routine. I could not get the P4/Perl
interface working on my Unix servers for a variety of
reasons (We don't have gcc on Solaris, the right version of
Perl, or administrative access to these machines), so I
wrote my own routines. Basically:

ztagRead("client", "nbk6n2b",
\%myHash) is similar to saying:

$p4->Tagged();
$p4->Connect();
[...] 
$myHashRef = $p4->FetchClient("nbk6n2b");
%myHash = %{$myHashRef};

That is, the output of the client record will be in the hash
%myHash.

The point is that this routine will help you print out the
structure of your client hash before you attempt to write
it. This will help determine whether the problem is in the
call to $p4-SaveClient or the structure of the client hash
itself. 

You should do this right after you do the
$p4->FetchClient, and before you do the
$p4->SaveClient calls. I use this routine all the time
when I write scripts, and it has saved me countless hours of
debugging.

-----Original Message-----
From: Scott Lavender [mailto:scott.lavendervisiprise.com] 
Sent: Friday, August 04, 2006 8:41 AM
To: Weintraub, David; mehta suman; p4perlperforce.com
Subject: RE: [p4perl] how to add views to a client

Thanks for that....

BTW, what module is 'ztagRead' part of. I can't seem to
find any docs on it...

-----Original Message-----
From: Weintraub, David [mailto:david.weintraubbofasecurities.com]
Sent: Friday, August 04, 2006 8:32 AM
To: mehta suman; Scott Lavender; p4perlperforce.com
Subject: RE: [p4perl] how to add views to a client


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-2]

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