[p4perl] Creating Users

Scott Lavender scott.lavender at visiprise.com
Wed Mar 8 06:02:31 PST 2006


Tony,

I get the following error when attempting to use SaveUser:

        Arg[ 1 ] unknown type 3
Invalid argument to P4::Run. Aborting command at C:/Perl/site/lib/P4.pm line 51.
Can't use an undefined value as an ARRAY reference at C:/Perl/site/lib/P4.pm line 53.

Code snippet:

# Save new user
    $p4->SaveUser( "-f", $user );
#    $p4->SetInput( $user );
#    $p4->Run("user", "-fi");

Thanks.....Scott...

-----Original Message-----
From: Tony Smith [mailto:tony at perforce.com]
Sent: Wednesday, March 08, 2006 6:21 AM
To: p4perl at perforce.com
Cc: Scott Lavender
Subject: Re: [p4perl] Creating Users



Hi Scott,

On Tuesday 07 March 2006 19:45, Scott Lavender wrote:
> Thanks for the help David. It works great. But, I have a follow up
> question. After modifying the user hash, what would be the corresponding
> way to save/create the user? I though it would be:
>
> $p4->SaveUser( $user );
>
> But, this does not seem to work.

If you're attempting to modify another user's details, you will need to invoke 
the power of the '-f' flag. This should do the trick:

	$p4->SaveUser( "-f", $user );

Note also that when things don't 'seem to work', it's worth printing the 
output returned from the command and the contents of the $p4->Errors() and 
$p4->Warnings() arrays. They'll yield valuable clues.

You can also use $p4->DebugLevel( 3 ) (in the latest builds of P4Perl) to see 
way more information than you really want. 

Tony



More information about the p4perl mailing list