![]() |
![]()
| ![]() |
![]()
NAME"Protocol::CassandraCQL::Frame" - a byte buffer storing the content of a CQL message frame DESCRIPTIONThis class provides wire-protocol encoding and decoding support for constructing and parsing Cassandra CQL message frames. An object represents a buffer during construction or parsing. To construct a message frame, create a new empty object and use the "pack_*" methods to append data to it, before eventually obtaining the actual frame bytes using "bytes". Each "pack_*" method returns the frame object, allowing them to be easily chained: my $bytes = Protocol::CassandraCQL::Frame->new ->pack_short( 123 ) ->pack_int( 45678 ) ->pack_string( "here is the data" ) ->bytes; To parse a message frame, create a new object from the bytes in the message, and use the "unpack_*" methods to consume the values from it. my $frame = Protocol::CassandraCQL::Frame->new( $bytes ); my $s = $frame->unpack_short; my $i = $frame->unpack_int; my $str = $frame->unpack_string; CONSTRUCTOR$frame = Protocol::CassandraCQL::Frame->new( $bytes )Returns a new frame buffer, optionally initialised with the given byte string. METHODS$bytes = $frame->bytesReturns the byte string currently in the buffer. $frame->pack_byte( $v )$v = $frame->unpack_byteAdd or remove a byte value. $frame->pack_short( $v )$v = $frame->unpack_shortAdd or remove a short value. $frame->pack_int( $v )$v = $frame->unpack_intAdd or remove an int value. $frame->pack_string( $v )$v = $frame->unpack_stringAdd or remove a string value. $frame->pack_lstring( $v )$v = $frame->unpack_lstringAdd or remove a long string value. $frame->pack_uuid( $v )$v = $frame->unpack_uuidAdd or remove a UUID as a plain 16-byte raw scalar $frame->pack_string_list( $v )$v = $frame->unpack_string_listAdd or remove a list of strings from or to an ARRAYref $frame->pack_bytes( $v )$v = $frame->unpack_bytesAdd or remove opaque bytes or "undef". $frame->pack_short_bytes( $v )$v = $frame->unpack_short_bytesAdd or remove opaque short bytes. $frame->pack_inet( $v )$v = $frame->unpack_inetAdd or remove an IPv4 or IPv6 address from or to a packed sockaddr string (such as returned from "pack_sockaddr_in" or "pack_sockaddr_in6". $frame->pack_string_map( $v )$v = $frame->unpack_string_mapAdd or remove a string map from or to a HASH of strings. $frame->pack_string_multimap( $v )$v = $frame->unpack_string_multimapAdd or remove a string multimap from or to a HASH of ARRAYs of strings. SPONSORSThis code was paid for by
AUTHORPaul Evans <leonerd@leonerd.org.uk>
|