<<

NAME

Inca::Client - A perl module for defining clients of Inca servers.

SYNOPSIS

  use Inca::Client;
  my $client = new Inca::Client(
    host => 'localhost',
    port => 6362,
    auth => 1,
    cert => 'etc/mycert.pem',
    init => 'etc/inca.properties',
    key => 'etc/mykey.pem',
    prefix => 'inca.client.',
    trusted => 'etc/mycert.pem',
    password => '1ncaD1nkaD00'
  );

DESCRIPTION

This module creates clients for Inca servers. It handles both unauthenticated and (where available) authenticated communication between client and server and implements methods that are supported by all Inca servers. This class will rarely be instantiated directly; more often, it will serve as the base class for other classes that communicate with particular Inca components.

CLASS METHODS

new

Class constructor which returns a new Inca::Client object. The constructor may be called with any of the following named parameters.

auth

A boolean value indicating whether or not the connection to the server should use certificate-based authentication. The default is false.

cert

The path to the certificate file. Required for authenticated connections.

host

The IP or DNS name of the server to contact. Required.

init

Optional path to an Inca properties file specifying values for other parameters.

key

The path to the private key file. Required for authenticated connections.

password

The password for decripting the private key file. Required for authenticated connections.

port

The server port to contact. Required.

prefix

Optional prefix for properties in the init file. The constructor ignores properties that lack this prefix and strips the prefix from those that have it.

trusted

The path to the trusted ca certificate file. Required for authenticated connections.

connected( )

Returns the server address if the client is connected, else undef.

connected( )

Returns the server address if the client is connected, else undef.

getError( )

Returns and clears any error that occurred during the most recent operation on the connection. Returns undef if no error occurred.

ping($text)

Sends $text to the server as part of a PING message and returns any successful response, which should be the same text.

setError($err)

Sets the error associated with this connection to $err. Mostly for internal and derived class use.

start($version)

Sends $version to the server as part of a START message and returns any successful response, which should be empty.

_dialog($message)

A convenience method for this class and derived classes. Sends $message to the server and returns any response, calling setError if the response indicates that an error occurred.

_read( )

A convenience method for this class and derived classes. Reads and returns a message from the server. Returns undef on EOF.

_write($message)

A convenience method for this class and derived classes. Sends $message to the server.

<<