API::MikroTik::Response - Parse responses from a buffer.
use API::MikroTik::Response; my $response = API::MikroTik::Response->new(); my $list = $response->parse(\$buff); for my $re (@$list) { my ($type, $tag) = delete @{$re}{'.type'. '.tag'}; say "$_ => $re->{$_}" for keys %$re; }
Parser for API protocol responses.
API::MikroTik::Response implements the following attributes.
my $items = $response->data;
Sentences fetched in last operation;
my $sentence = $response->sentence; $response->sentence(API::MikroTik::Sentence->new());
API::MikroTik::Sentence object used to decode sentences from network buffer.
my $list = $response->parse(\$buff);
Parses data from a buffer and returns list of hashrefs with attributes for each sentence. There are some special attributes:
'.tag' => 1
Reply tag.
'.type' => '!re'
Reply type.
API::MikroTik
To install API::MikroTik, copy and paste the appropriate command in to your terminal.
cpanm
cpanm API::MikroTik
CPAN shell
perl -MCPAN -e shell install API::MikroTik
For more information on module installation, please visit the detailed CPAN module installation guide.