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


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


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


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).


  • $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

    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'}


None by default.


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

This module was written by the SynchroEdit team who're at

There is a wiki at:


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


Kalle Alm <>


Copyright (C) 2006 by Alacrity Management Corp.

Version: MPL 1.1/LGPL 2.1

The contents of this file are subject to the Mozilla Public License Version 1.1 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

Software distributed under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the specific language governing rights and limitations under the License.

The Original Code is SynchroEdit (

The Initial Developer of the Original Code is Kalle Alm ( Portions created by the Initial Developer are Copyright (C) 2006 Alacrity Management Corporations. All Rights Reserved.


Alternatively, the contents of this file may be used under the terms of the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), in which case the provisions of the LGPL are applicable instead of those above. If you wish to allow use of your version of this file only under the terms of the LGPL, and not to allow others to use your version of this file under the terms of the MPL, indicate your decision by deleting the provisions above and replace them with the notice and other provisions required by the LGPL. If you do not delete the provisions above, a recipient may use your version of this file under the terms of any one of the MPL or the LGPL.