NAME
Text::Netstring - Perl module for manipulation of netstrings
SYNOPSIS
use Text::Netstring qw(netstring_encode netstring_decode netstring_verify);
$ns = netstring_encode($text);
@ns = netstring_encode(@text);
$ns = netstring_encode(@text);
$text = netstring_decode($ns);
@text = netstring_decode(@ns);
$text = netstring_decode(@ns);
$valid = netstring_verify($string);
@valid = netstring_verify(@string);
DESCRIPTION
This module is a collection of functions to make use of netstrings in your perl programs. A netstring is a string encoding used by, at least, QMTP and QMQP.
- netstring_encode()
-
Encode the supplied string, or list of strings, as a netstring.
Supplying a scalar argument in a scalar context or list argument in list context does what you'd expect; encoding the scalar or each element of the list, as appropriate. Supplying a list argument in a scalar context, however, returns a single scalar which is the concatenation of each element of the list encoded as a netstring.
- netstring_decode()
-
Decode the supplied netstring, or list of netstrings, returning the interpretation of each.
The same context handling as for netstring_encode() applies.
- netstring_verify()
-
Check the validity of the supplied netstring, or list of netstrings. Returns a
TRUE
orFALSE
value, or list of same, as appropriate. Supplying a list argument in a scalar context will return a value for the first element of the list only.
NOTES
The format of a netstring is described in http://cr.yp.to/proto/qmtp.txt
AUTHOR
James Raftery <james@now.ie>.