[p4perl] Help for a beginner

Tony Smith tony@smee.org
Tue, 21 Dec 2004 09:01:26 +0000


Hi John,

> I am keen to try and code some scripts which will automate a number of
> little tasks for us. As I already have perl 5.6, I simply downloaded
> P4perl and attempted to use the "Synopsis" code to get me started:
>
> P4::Client::Run() - Client has not been initialised at
>
> :/Perl/site/lib/P4.pm line 223.
>
> Failed to connect to Perforce Server at p4perl.pl line 11.
>
>
> I am clearly missing something ... Here is my code:

I'm not sure that you are. Your code looks OK to me. 

> use P4;
> my $p4 = new P4;
> $user = "<<myP4Username>>";
> $clientname = "<<myP4ClientSpecName>>";
> $p4port = "<<myP4serverHost:port>>";
>
> $p4->SetUser ( $user );
> $p4->SetClient( $clientname );
> $p4->SetPort ( $p4port );
> #$p4->SetPassword( $p4password );
> $p4->Connect() or die( "Failed to connect to Perforce Server" );
>
> my $info = $p4->Run( "info" );
> #$p4->Edit( "file.txt" ) or die( "Failed to edit file.txt" );
> $p4->Disconnect();
>
> I am working on Windows XP.

Which version of P4Perl are you using? (Look for '$VERSION' in P4.pm)

Tony