[p4perl] integrating perforce with a build system.

Tony Smith tony at smee.org
Mon Feb 21 09:30:51 PST 2005

On Monday 21 February 2005 13:20, Roger Day wrote:
> Well, I'm almost there
> use P4;
> # Initialisation
> my $p4 = new P4;
> $p4->Init() or die( "Failed to connect to Perforce" );
> $return = $p4->SetCwd("c:\\users\\rday\\perforcews\\");
> print "$return\n";
> $return = $p4->Run("sync","-f","//depot/makedist/...");
> print "@$return\n";
> SetCwd seems to have no effect at all. It's overriden by the client spec.

Right. SetCwd() will only make a difference to how Perforce computes relative 
paths. For example:

    $p4->Run( "sync", "../../makedist/..." );

The client spec is the ultimate arbiter of what goes where.

> Which is crucial to what I'm doing. Do I have to edit the client spec every
> time I want to do a checkout?

Not unless you're intending to work with different files. The normal usage 
would be to have your client spec map ALL of the files your build system 
would work with and then either 'p4 sync' or 'p4 sync-f' to have Perforce 
populate the build tree. Then you build as normal.



More information about the p4perl mailing list