VCS::LibCVS::Client::Response - a response in the CVS client protocol
my @responses = Client::Response->read_from_server($server_conn); if (($responses[-1]->isa("VCS::LibCVS::Client::Response::error"))) { my $errors; foreach my $resp (@responses) { $errors .= $resp->get_errors(); }; confess "Request failed: $errors"; } else { # remove the "ok" response pop @responses; }
This is a generic superclass for all of the various responses in the cvsclient protocol. A response includes zero or more pieces of data (LibCVS::Datum), which the server sends. Subclasses of this class should be instantiated, not this class itself.
If a user of the library cannot handle all types of responses from the server it can tailor which responses it can receive in the Client; but only before the connection is established. To do this, use the valid_responses() routine of the VCS::LibCVS::Client class.
The data types for each response are predetermined. Check its documentation to find out what they are. Each response can be queried for its type and the data which it contains, returned as subclasses of LibCVS::Datum. They
@responses = Client::Response->read_from_ioh($conn)
Read a list of responses from the server.
An IO::Handle from which the list of responses should be read. Typically this will be a link directly from the server.
Reads a list of responses from the server, stopping when it receives an "ok" or "error". This is the typical way to get a response. The number of responses received is unpredictable, as additional responses may be included.
It will block if there is not at least one response.
$response = Client::Response->new($name, $conn)
Read a single response of the given name from the server.
The name of the response as read from the server.
A IO::Handle from which the response should be read. Typically this will be a link directly from the server.
Reads a single response from the server and creates an object for it. This routine should only be called in read_from_server above. Users of the libary should call that one, not this one.
The name of the response has already been read from the server. It is similar but not identical to the class name of the response. The only issue is that the '-' character has been replaced by '_'.
$is_terminal = $response->terminal()
Indicates if this is a terminal response.
A terminal response terminates the list of responses that the server is sending to the user. Only 'ok' and 'error' are terminal responses.
@arg_types = $response->included_data()
The types of the args that this response expects
Each string is the name of a subpackage of Datum. They are used to construct the response as it is read from the server.
$error_message = $response->get_errors()
Returns any error messages
If the response is an error message it will return its string. Otherwise it will return undef.
$message = $response->get_message()
Returns any regular messages
If the response is a message (M or MB) it will return its string. Otherwise it will return undef.
$response_string = $response->as_protocol_string()
Returns the Client::Response as a string as it was received from the server.
$response_data = $response->data()
The order of the returned data is documented for each Response.
VCS::LibCVS::Client VCS::LibCVS::Client::Response::Responses VCS::LibCVS::Client::Response::FileUpdatingResponses VCS::LibCVS::Client::Response::FileUpdateModifyingResponses
To install VCS::LibCVS, copy and paste the appropriate command in to your terminal.
cpanm
cpanm VCS::LibCVS
CPAN shell
perl -MCPAN -e shell install VCS::LibCVS
For more information on module installation, please visit the detailed CPAN module installation guide.