API-MikroTik
view release on metacpan or search on metacpan
lib/API/MikroTik/Response.pm view on Meta::CPAN
=head1 SYNOPSIS
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;
}
=head1 DESCRIPTION
Parser for API protocol responses.
=head1 ATTRIBUTES
L<API::MikroTik::Response> implements the following attributes.
lib/API/MikroTik/Sentence.pm view on Meta::CPAN
my $command = '/interface/print';
my $attr = {'.proplist' => '.id,name,type'};
my $query = {type => ['ipip-tunnel', 'gre-tunnel'], running => 'true'};
my $tag = 1;
my $bytes = encode_sentence($command, $attr, $query, $tag);
my $sentence = API::MikroTik::Sentence->new();
my $words = $sentence->fetch(\$bytes);
say $_ for @$words;
=head1 DESCRIPTION
Provides subroutines for encoding API sentences and parsing them back into words.
=head1 METHODS
=head2 encode_sentence
my $bytes = encode_sentence($command, $attr, $query, $tag);
( run in 0.832 second using v1.01-cache-2.11-cpan-b85c58fdc1d )