| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
=head1 NAME |
|
2
|
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
Cli::Router - Routes commands to their implementation |
|
4
|
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
6
|
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
If you want to "register" a new command, do it here. For more information about how an actual implementation should look like |
|
8
|
|
|
|
|
|
|
please refer to L. |
|
9
|
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
=head1 METHODS |
|
11
|
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
=cut |
|
13
|
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
package Wireguard::WGmeta::Cli::Router; |
|
15
|
1
|
|
|
1
|
|
78196
|
use strict; |
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
31
|
|
|
16
|
1
|
|
|
1
|
|
7
|
use warnings FATAL => 'all'; |
|
|
1
|
|
|
|
|
5
|
|
|
|
1
|
|
|
|
|
35
|
|
|
17
|
1
|
|
|
1
|
|
5
|
use experimental 'signatures'; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
8
|
|
|
18
|
1
|
|
|
1
|
|
637
|
use Wireguard::WGmeta::Cli::Commands::Show; |
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
35
|
|
|
19
|
1
|
|
|
1
|
|
455
|
use Wireguard::WGmeta::Cli::Commands::Set; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
30
|
|
|
20
|
1
|
|
|
1
|
|
443
|
use Wireguard::WGmeta::Cli::Commands::Help; |
|
|
1
|
|
|
|
|
4
|
|
|
|
1
|
|
|
|
|
28
|
|
|
21
|
1
|
|
|
1
|
|
450
|
use Wireguard::WGmeta::Cli::Commands::Enable; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
31
|
|
|
22
|
1
|
|
|
1
|
|
517
|
use Wireguard::WGmeta::Cli::Commands::Disable; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
34
|
|
|
23
|
1
|
|
|
1
|
|
449
|
use Wireguard::WGmeta::Cli::Commands::Apply; |
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
28
|
|
|
24
|
1
|
|
|
1
|
|
459
|
use Wireguard::WGmeta::Cli::Commands::Add; |
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
30
|
|
|
25
|
1
|
|
|
1
|
|
478
|
use Wireguard::WGmeta::Cli::Commands::Remove; |
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
29
|
|
|
26
|
|
|
|
|
|
|
|
|
27
|
1
|
|
|
1
|
|
6
|
use base 'Exporter'; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
503
|
|
|
28
|
|
|
|
|
|
|
our @EXPORT = qw(route_command); |
|
29
|
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
our $VERSION = "0.3.3"; |
|
31
|
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
=head2 route_command($ref_list_input_args) |
|
33
|
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
Routes the cmd (first argument of C<@ARGV>) to their implementation. The case of the commands to not matter. |
|
35
|
|
|
|
|
|
|
Any unknown command is forwarded to L. |
|
36
|
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
To add a new command add this to the C block: |
|
38
|
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
/^your_cmd$/ && do { |
|
40
|
|
|
|
|
|
|
Wireguard::WGmeta::Cli::Commands::YourCmd->new(@cmd_args)->entry_point(); |
|
41
|
|
|
|
|
|
|
last; |
|
42
|
|
|
|
|
|
|
}; |
|
43
|
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
B |
|
46
|
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
=over 1 |
|
48
|
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
=item |
|
50
|
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
C<$ref_list_input_args> Reference to C<@ARGV>) |
|
52
|
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
=back |
|
54
|
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
B |
|
56
|
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
None |
|
58
|
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
=cut |
|
60
|
5
|
|
|
5
|
1
|
1643
|
sub route_command($ref_list_input_args) { |
|
|
5
|
|
|
|
|
13
|
|
|
|
5
|
|
|
|
|
7
|
|
|
61
|
5
|
|
|
|
|
15
|
my ($cmd,@cmd_args) = @$ref_list_input_args; |
|
62
|
5
|
50
|
|
|
|
15
|
if (!defined $cmd){ |
|
63
|
0
|
|
|
|
|
0
|
Wireguard::WGmeta::Cli::Commands::Help->new->entry_point; |
|
64
|
|
|
|
|
|
|
} |
|
65
|
5
|
|
|
|
|
13
|
for ($cmd) { |
|
66
|
5
|
50
|
|
|
|
17
|
/^show$/ && do { |
|
67
|
0
|
|
|
|
|
0
|
Wireguard::WGmeta::Cli::Commands::Show->new(@cmd_args)->entry_point(); |
|
68
|
0
|
|
|
|
|
0
|
last; |
|
69
|
|
|
|
|
|
|
}; |
|
70
|
5
|
100
|
|
|
|
23
|
/^set$/ && do { |
|
71
|
3
|
|
|
|
|
29
|
Wireguard::WGmeta::Cli::Commands::Set->new(@cmd_args)->entry_point(); |
|
72
|
2
|
|
|
|
|
45
|
last; |
|
73
|
|
|
|
|
|
|
}; |
|
74
|
2
|
100
|
|
|
|
9
|
/^enable$/ && do { |
|
75
|
1
|
|
|
|
|
15
|
Wireguard::WGmeta::Cli::Commands::Enable->new(@cmd_args)->entry_point(); |
|
76
|
1
|
|
|
|
|
30
|
last; |
|
77
|
|
|
|
|
|
|
}; |
|
78
|
1
|
50
|
|
|
|
7
|
/^disable$/ && do { |
|
79
|
1
|
|
|
|
|
13
|
Wireguard::WGmeta::Cli::Commands::Disable->new(@cmd_args)->entry_point(); |
|
80
|
1
|
|
|
|
|
27
|
last; |
|
81
|
|
|
|
|
|
|
}; |
|
82
|
0
|
0
|
|
|
|
|
/^addpeer$/ && do { |
|
83
|
0
|
|
|
|
|
|
Wireguard::WGmeta::Cli::Commands::Add->new(@cmd_args)->entry_point(); |
|
84
|
0
|
|
|
|
|
|
last; |
|
85
|
|
|
|
|
|
|
}; |
|
86
|
0
|
0
|
|
|
|
|
/^removepeer$/ && do { |
|
87
|
0
|
|
|
|
|
|
Wireguard::WGmeta::Cli::Commands::Remove->new(@cmd_args)->entry_point(); |
|
88
|
0
|
|
|
|
|
|
last; |
|
89
|
|
|
|
|
|
|
}; |
|
90
|
0
|
0
|
|
|
|
|
/^apply$/ && do { |
|
91
|
0
|
|
|
|
|
|
Wireguard::WGmeta::Cli::Commands::Apply->new(@cmd_args)->entry_point(); |
|
92
|
0
|
|
|
|
|
|
last; |
|
93
|
|
|
|
|
|
|
}; |
|
94
|
0
|
|
|
|
|
|
Wireguard::WGmeta::Cli::Commands::Help->new->entry_point; |
|
95
|
|
|
|
|
|
|
} |
|
96
|
|
|
|
|
|
|
} |
|
97
|
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
1; |