line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package MikroTik::API; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
9412
|
use 5.006; |
|
1
|
|
|
|
|
6
|
|
4
|
1
|
|
|
1
|
|
9
|
use strict; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
43
|
|
5
|
1
|
|
|
1
|
|
9
|
use warnings FATAL => 'all'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
165
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
=head1 NAME |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
MikroTik::API - The great new MikroTik::API! |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
=head1 VERSION |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
Version 0.02-TRIAL |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
=cut |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
our $VERSION = '0.02-TRIAL'; |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
=head1 SYNOPSIS |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
Quick summary of what the module does. |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
Perhaps a little code snippet. |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
use MikroTik::API; |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
my $api = MikroTik::API->new({ |
29
|
|
|
|
|
|
|
host => 'mikrotik.example.org', |
30
|
|
|
|
|
|
|
username => 'whoami', |
31
|
|
|
|
|
|
|
password => 'SECRET', |
32
|
|
|
|
|
|
|
use_ssl => 1, |
33
|
|
|
|
|
|
|
}); |
34
|
|
|
|
|
|
|
my ( $ret_get_identity, @aoh_identity ) = $api->query( '/system/identity/print', {}, {} ); |
35
|
|
|
|
|
|
|
print "Name of router: $aoh_identity[0]->{name}\n"; |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
$api->logout(); |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
=head1 SUBROUTINES/METHODS |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
=head2 function1 |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
=cut |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
0
|
1
|
|
sub function1 { |
46
|
|
|
|
|
|
|
} |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
=head2 function2 |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
=cut |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
0
|
1
|
|
sub function2 { |
53
|
|
|
|
|
|
|
} |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
=head1 AUTHOR |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
Martin Gojowsky, C<< >> |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
=head1 BUGS |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
Please report any bugs or feature requests to C, or through |
62
|
|
|
|
|
|
|
the web interface at L. I will be notified, and then you'll |
63
|
|
|
|
|
|
|
automatically be notified of progress on your bug as I make changes. |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
=head1 SUPPORT |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
You can find documentation for this module with the perldoc command. |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
perldoc MikroTik::API |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
You can also look for information at: |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
=over 4 |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
=item * RT: CPAN's request tracker (report bugs here) |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
L |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
=item * AnnoCPAN: Annotated CPAN documentation |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
L |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
=item * CPAN Ratings |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
L |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
=item * Search CPAN |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
L |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
=back |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
=head1 ACKNOWLEDGEMENTS |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
=head1 LICENSE AND COPYRIGHT |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
Copyright 2015 Martin Gojowsky. |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
This program is distributed under the MIT (X11) License: |
106
|
|
|
|
|
|
|
L |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
Permission is hereby granted, free of charge, to any person |
109
|
|
|
|
|
|
|
obtaining a copy of this software and associated documentation |
110
|
|
|
|
|
|
|
files (the "Software"), to deal in the Software without |
111
|
|
|
|
|
|
|
restriction, including without limitation the rights to use, |
112
|
|
|
|
|
|
|
copy, modify, merge, publish, distribute, sublicense, and/or sell |
113
|
|
|
|
|
|
|
copies of the Software, and to permit persons to whom the |
114
|
|
|
|
|
|
|
Software is furnished to do so, subject to the following |
115
|
|
|
|
|
|
|
conditions: |
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
The above copyright notice and this permission notice shall be |
118
|
|
|
|
|
|
|
included in all copies or substantial portions of the Software. |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, |
121
|
|
|
|
|
|
|
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES |
122
|
|
|
|
|
|
|
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
123
|
|
|
|
|
|
|
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT |
124
|
|
|
|
|
|
|
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, |
125
|
|
|
|
|
|
|
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
126
|
|
|
|
|
|
|
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR |
127
|
|
|
|
|
|
|
OTHER DEALINGS IN THE SOFTWARE. |
128
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
=cut |
131
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
1; # End of MikroTik::API |