Net::SynchroEdit::Service - Perl extension for SynchroEdit response service functionality


Net-SynchroEdit-Service documentation  | view source Contained in the Net-SynchroEdit-Service distribution.

Index


NAME

Top

Net::SynchroEdit::Service - Perl extension for SynchroEdit response service functionality

SYNOPSIS

Top

  use Net::SynchroEdit::Service;

  my $conn = new Net::SynchroEdit::Service;
  $conn->connect("localhost", 7962, "root", "secret");

DESCRIPTION

Top

Net::SynchroEdit::Service provides a complete set of methods for manipulating a SynchroEdit server via the response service. The optional Net::SynchroEdit::Controller and Net::SynchroEdit::Session modules can be used in conjunction with the Service module to acquire e.g. the create_from_file method (Controller).

METHODS

* $conn->connect([$host = "localhost"[, $port = 7962[, $user = "root"[, $pass = "secret"]]]])

Connect to a SynchroEdit response service. Returns 1 if connection established.

* $conn->disconnect()

Disconnect from connected response service.

* $conn->sessions([$extended = 0])

Request a list of existing sessions on the SynchroEdit server. If $extended is set (1), an additional STATUS request is sent per document. On success, returns a map with a set of values. The "SIDS" key contains a list of the sessions, space-separated. The data of a particular session can be retrieved using the get() method. If $extended, each entry additionally contains AGE, USERS, CONTRIBUTORS, and DOCSIZE. See $conn->get() below for further information.

* $conn->get($sid)

Acquire a hashmap based on the most recently made sessions()-call for the specified session. The following keys will be available always (presuming the session identifier is valid): "DOCUMENT", "PORT", "FLAGS" The following keys will be available if the sessions()-call was extended: "AGE", "USERS", "CONTRIBUTORS", "DOCSIZE"

* $conn->query($cmd)

Perform a query directly to the response service. For detailed information on what queries there are, how they work, and why they exist, see http://wiki.synchroedit.com/index.php/SessionProtocol

Note that the query() function returns 1 on success. No query handlers exist, but the results of each query is simply retrieved in the order they were made.

Wrong: my $qid = $conn->query("QUERY"); my $status = $conn->fetch_status($qid);

Right: $conn->query("QUERY"); my $status = $conn->fetch_status();

* $conn->fetch_result()

Get the next pending result as an array. Each element in the array corresponds to one line in the response service response. The "END" statement is not included in the resulting array but is used to determine where the array ends.

* $conn->fetch_status()

Fetch the first line only in a pending result. The remaining data, if any, is discarded.

* $conn->fetch_map()

Return the next pending result as a hashmap. This is only supported when the response is a list of keys and values in the format "KEY VALUE\nKEY2 VALUE2\n..."

* $conn->shutdown($SID[, $timer = 0])

Shut the specified session down in $timer minutes.

* $conn->fetch_info()

Re-fetch information from service, about service. Returns 1 if successful. The information is stored in the instance itself, and is available as: $conn->{'localPath'}, $conn->{'uptime'} and $conn->{'serverModel'}

EXPORT

None by default.

SEE ALSO

Top

See the documentation page for Net::SynchroEdit::Controller and Net::SynchroEdit::Session.

This module was written by the SynchroEdit team who're at http://www.synchroedit.com/.

There is a wiki at: http://wiki.synchroedit.com/.

KNOWN BUGS

Top

The $timer argument to the shutdown functionality is currently not working. Sessions are shut down immediately, regardless of its value.

AUTHOR

Top

Kalle Alm <kalle@enrogue.com>

COPYRIGHT AND LICENSE

Top


Net-SynchroEdit-Service documentation  | view source Contained in the Net-SynchroEdit-Service distribution.