List Info

Thread: Creating Users




Creating Users
user name
2006-03-08 14:02:31
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:tonyperforce.com]
Sent: Wednesday, March 08, 2006 6:21 AM
To: p4perlperforce.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

_______________________________________________
p4perl mailing list
p4perlperforce.com

http://maillist.perforce.com/mailman/listinfo/p4perl
Creating Users
user name
2006-03-08 15:05:17
Hi Scott,

> 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");

My apologies Scott. This is caused by passing the reference
(type 3) last. The 
arguments should be the other way round:

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

When using the Save* shortcuts, always pass the hash
reference as the first 
argument, followed by any flags/additional arguments.

Tony
_______________________________________________
p4perl mailing list
p4perlperforce.com

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

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