[p4perl] "p4 -x file" in the P4 module?

Tony Smith tony at smee.org
Sat Apr 11 08:20:14 PDT 2009

Hi Tim,

You'd need to code it yourself in P4Perl: 'p4 -x' is implemented as 
batched calls to ClientApi::Run() in p4 itself, and that's what you'd 
need to do in P4Perl. It's pretty easy to do; just read lines from your 
input file, and pass the results as arguments to P4::RunFiles() (in your 
example). So it should look like:

    $p4->RunFiles( @array_of_filenames_read_from_input );

Hope that helps,


Tim McDaniel wrote:
> When using the P4 module, is there a way to get the effect of, for
> example,
>      p4 -x infile files?
> Doing
>      $p4->Run('-x', 'infile', 'files')
> results in "Unknown command".
> There is
>      P4::SetInput( arg )
>      Save the supplied argument as input to be supplied to a subsequent
>      command. The input may be: a hashref, a scalar string or an array
>      of hashrefs or scalar strings. Note that if you pass an array the
>      array will be shifted once each time the Perforce command being
>      executed asks for user input.
> But that reads from memory.  Of course it's straightforward enough for
> my code to read the 257KB file into an array, but it's shorter if I
> can get P4 to do it.

More information about the p4perl mailing list