h end devices are connected to which switch ports on which
switches and routers. It also offers a JSON-based client API, for which
this module is an implementation.
In addition to Porttracker, the Po
();
use AnyEvent ();
use AnyEvent::Handle ();
use MIME::Base64 ();
use Digest::HMAC_MD6 ();
use JSON ();
our $VERSION = '1.01';
sub call {
my ($self, $type, @args) = @_;
$self->{$type}
=> sub {
while ($_[0]{rbuf} =~ s/^([^\x0a]*)\x0a//) {
my $msg = JSON::decode_json $1;
my $id = shift @$msg;
if (defined $id) {
g and receiving JSON arrays encoded as
UTF-8. The server expects JSON arrays to be sent back-to-back, without any
separators, but for testing purposes it is often convenient to end JSON
arrays with AS
protocol.
To support programming languages without incremental JSON parsers,
the server will append an ASCII LF character to each JSON array and
additionally will make sure that its replies will nev
in any ASCII
LF characters, so instead of directly parsing the JSON stream, the client
may also read single lines and then decode the JSON array contained in
each line.
Note 1: This means that one ca