Stephen Vance > P4-Server-0.11.1 > P4::Server

Download:
P4-Server-0.11.1.tgz

Dependencies

Annotate this POD

View/Report Bugs
Module Version: 0.11   Source  

NAME ^

P4::Server - Perl wrapper for control of a Perforce server

VERSION ^

Version 0.11

SYNOPSIS ^

This module provides for control and configuration of a Perforce server.

    use Error qw( :try );
    use P4::Server;

    my $server = P4::Server->new( {
            port    => $port,
    ) };
    $server->create_temp_root();
    $server->set_cleanup( 1 );
    $server->start_p4d();

    try {
        $server->load_journal_file( $journalfile );
    }
    catch P4::Server::Exception with {
        # Handle the error
    };
    
    # Do some operations against the server
    # Automatically stops the server and cleans up based on the cleanup flag

METHODS ^

clean_up_root

If the clean up flag is set and the root is defined, automatically removes the server root.

Throws

create_temp_root

Creates a temporary directory and sets it as the server root. This directory will be cleaned up when the program exits according to the state of the cleanup attribute when this method is called.

get_cleanup

Returns whether the object is set to clean up the server root upon destruction.

get_journal

Returns the server journal name.

get_log

Returns the server log name.

get_p4d_exe

Returns the name of the currently set p4d executable.

get_p4d_timeout

Returns the number of seconds P4::Server will wait for p4d to start. See "set_p4d_timeout" for the exact definition of what this means.

get_pid

Returns the PID of the running server, if any.

get_port

Returns the Perforce port for the server.

get_root

Returns the server root.

load_journal_file

Loads the specified file as a journal into the Perforce server for this object. The server does not have to be running.

Parameters

Throws

load_journal_string

Loads the specified string as a journal into the Perforce server for this object. Creates a temporary file, loads the journal file from it, and removes the file. The server does not have to be running.

new

Constructor for P4::Server. Takes an optional hash argument of parameters for the server. The valid keys in the hash are:

Throws

set_cleanup

A true value tells the object to clean up the server root upon destruction.

set_journal

Gets the server journal name.

set_log

Sets the server log name.

set_p4d_exe

Sets the p4d executable to use. An undefined argument sets the value back to the default ('p4d').

Throws

set_p4d_timeout

Sets the minimum number of seconds P4::Server will wait for p4d to start before giving up. Because of the nature of the tests being applied, the actual wait time is unpredictable and theoretically unbounded, although practically very finite.

Throws

Nothing

set_port

Sets the Perforce port for the server. If the port is set to undef, the port will be dynamically allocated when the server is started. At that point a port will be assigned. If the server is stopped and restarted, the assigned port will continue to be used unless the port is reset to undef.

set_root

Sets the server root with the side-effect of invoking clean_up_root.

Throws

start_p4d

Starts the server with the current settings. If the port is undefined, a port will be dynamically assigned. That port will continue to be used through stops and starts until the port is reset to undef.

Throws

stop_p4d

Stops the currently running server for this object.

unpack_archive_to_root_dir

Unpacks an archive of any type supported by Archive::Extract into the currently set root directory for the server.

It is expected that the archive consists of depot files and checkpoints made relative to the server root directory.

Returns

An array reference with the paths of all the files in the archive, relative to the server root.

Throws

BUILD

Constructor invoked by Class::Std

DEMOLISH

Destructor invoked by Class::Std. Invokes stop_p4d and clean_up_root.

AUTHOR ^

Stephen Vance, <steve at vance.com>

BUGS ^

Please report any bugs or feature requests to bug-p4-server at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=P4-Server. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

SUPPORT ^

You can find documentation for this module with the perldoc command.

    perldoc P4::Server

You can also look for information at:

ACKNOWLEDGEMENTS ^

Thank you to The MathWorks, Inc. for sponsoring this work and to the BaT Team for their valuable input, review, and contributions.

COPYRIGHT & LICENSE ^

Copyright 2007-8 Stephen Vance, all rights reserved.

This program is released under the following license: Artistic

syntax highlighting: