The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

P4::UI - User interface object for Perforce API

SYNOPSIS

  use P4::Client;
  use P4::UI;

  my $client = new P4::Client;
  my $ui = new P4::UI;

  $client->SetClient( $clientname );
  $client->SetPort ( $p4port );
  $client->SetPassword( $p4password );
  $client->Init() or die( "Failed to connect to Perforce Server" );
  $client->Run( $ui, "info" );
  $client->Run( $ui, "edit", "file.txt" );
  $client->Final();

DESCRIPTION

This module provides a skeleton user interface for Perforce commands. The output from the Perforce server is simply written to stdout, and input comes from stdin. In order to do anything clever, you will need to derive a subclass from P4::UI and override the appropriate methods.

EXPORTS

        UI::new()       - Create a new user interface object

METHODS

new()
        Constructor. The only method of this class you call
        directly.
Edit( $filename )
        Method called when the Perforce server wants the client to
        edit a specform ( changespec, jobspec, clientspec etc.). 
        The default implementation simply invokes your chosen editor
        by checking the environment variables P4EDITOR and EDITOR
        before falling back on vi/notepad and hoping they're there.
ErrorPause( $message )
        Called to alert the user to an error message which they
        must acknowledge before continuing. Default implementation
        prints the message on stdout and prompts the user to "Hit
        Return to continue".
InputData()
        Used to read information directly from the user. Called
        in response to the "-i" flag to many Perforce commands.
        i.e. "p4 submit -i".
OutputInfo( $level, $data )
        Writes data to stdout prefixed by $level occurances of 
        "..." 
OutputError( $error )
        Blurt an error to stderr. The error message arrives 
        as preformatted text. 
OutputStat( $hashref )
        Print the output of a command in tagged format. The tagged
        data is passed as a hash reference for ease of use.
OutputText( $text, $length )
        Prints $length bytes of $text on STDOUT
Prompt( $prompt )
        Prints the prompt string $prompt and then reads a line
        of input from the user returning the input line.

LICENCE

Copyright (c) 1997-2001, Perforce Software, Inc. All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.

2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL PERFORCE SOFTWARE, INC. BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

AUTHOR

Tony Smith, Perforce Software ( tony@perforce.com )

SEE ALSO

perl(1), P4::Client(3), Perforce API documentation.