Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Contact Us
Online Help
Domain Status
Man Pages

Virtual Servers

Topology Map

Server Agreement
Year 2038

USA Flag



Man Pages

Manual Reference Pages  -  PROTOCOL::CASSANDRACQL::CLIENT (3)

.ds Aq ’


"Protocol::CassandraCQL::Client" - a minimal Cassandra CQL client



 use Protocol::CassandraCQL::Client;
 use Protocol::CassandraCQL qw( CONSISTENCY_QUORUM );

 my $cass = Protocol::CassandraCQL::Client->new(
    PeerHost => "localhost",
    Keyspace => "my-keyspace",

 my ( undef, $result ) = $cass->query( "SELECT v FROM numbers" );

 foreach my $row ( $result->rows_hash ) {
    say "We have a number $row->{v}";


This subclass of IO::Socket::IP implements a client that can execute queries on a Cassandra CQL database. It is not intended as a complete client, is simply provides enough functionallity to test that the protocol handling is working, and is used to implement the bundled examples/cqlsh utility.

For a more complete client, see instead Net::Async::CassandraCQL.


CW$cass = Protocol::CassandraCQL::Client->new( CW%args )

Takes the following arguments in addition to those accepted by IO::Socket::IP:
Username => STRING
Password => STRING Authentication credentials if required by the server.
Keyspace => STRING If defined, selects the keyspace to USE after connection.
CQLVersion => INT If defined, sets the CQL protocol version that will be negotiated. If omitted will default to 1.


( CW$result_op, CW$result_frame ) = CW$cass->send_message( CW$opcode, CW$frame )

Sends a message with the given opcode and Protocol::CassandraCQL::Frame for the message body. Waits for a response to be received, and returns it.

If the response opcode is OPCODE_ERROR then the error message string is thrown directly as an exception; this method will only return in non-error cases.

( CW$type, CW$result ) = CW$cass->query( CW$cql, CW$consistency )

Performs a CQL query and returns the result, as decoded by parse_result_frame in Protocol::CassandraCQL::Frames.

For USE queries, the type is RESULT_SET_KEYSPACE and $result is a string giving the name of the new keyspace.

For CREATE, ALTER and DROP queries, the type is RESULT_SCHEMA_CHANGE and $result is a 3-element ARRAY reference containing the type of change, the keyspace and the table name.

For SELECT queries, the type is RESULT_ROWS and $result is an instance of Protocol::CassandraCQL::Result containing the returned row data.

For other queries, such as INSERT, UPDATE and DELETE, the method returns RESULT_VOID and $result is undef.

( CW$type, CW$result ) = CW$cass->use_keyspace( CW$keyspace )

A convenient shortcut to the USE $keyspace query which escapes the keyspace name.


o Consider how the server’s maximum supported CQL version can be detected on startup. This is made hard by the fact that the server closes the connection if the version is too high, so we’ll have to reconnect it.


This code was paid for by
o Perceptyx <>
o Shadowcat Systems <>


Paul Evans <>
Search for    or go to Top of page |  Section 3 |  Main Index

perl v5.20.3 PROTOCOL::CASSANDRACQL::CLIENT (3) 2016-03-17

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with manServer 1.07.