List Info

Thread: Creating Users




Creating Users
user name
2006-03-07 18:59:58
You don't need the "-f" in the FetchUsers method. In fact, I'm not even sure it takes it. Try:
 
$user = $p4->FetchUser("testUser");
 
or
 
$user = $p4->Run("users", "-o", "testUser");
 
Which is the equivalent. If you need the "-f" parameter, you'll have to do this:
 
$user = $p4->Run("users", "-of", "testUser");
 
Fetch user will also return a new user too, so you can't use it to test to see if a user already exists. Use:
 
$userList = $p4->FetchUsers();
 
or
 
$userList = $p4->Run("users", "-o");
 
if the first method doesn't work. Then, you have to parse what was returned to see if the user actually exists. I'm not 100% sure what this will return. You'll have to play around with it a bit. If you also set P4->Tagged(), this should return a reference to an array of hashes.


From: p4perl-bouncesperforce.com [mailto:p4perl-bouncesperforce.com] On Behalf Of Scott Lavender
Sent: Tuesday, March 07, 2006 1:27 PM
To: p4perlperforce.com
Subject: [p4perl] Creating Users

I need to write a script to create users. But, I am having problems performing a fetch on the user command. First I thought of using this:
 

require P4;
my $p4 = new P4;
 
$p4->ParseForms();
$p4->Connect or die ( "Failed to connect to Perforce Server" );

my $fetched = $p4->FetchUser( "-f testUser" );
...

 
Nothing is returned by the call to FetchUser. I assume it has to do with the force option. Is there a way to do this when creating new users?
 
Thanks.....
 
Scott Lavender | SCM Specialist | Visiprise | office: 770.619.4166 | www.visiprise.com
 

It is our company policy not to accept email of any data controlled by the International Traffic in Arms Regulations (ITAR). Please contact our Security Officer, Matt Reeves, for instructions and authorization to transmit such data.

 
[1]

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