line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package App::LLEvalBot::CLI; |
2
|
1
|
|
|
1
|
|
63976
|
use strict; |
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
328
|
|
3
|
1
|
|
|
1
|
|
8
|
use warnings; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
35
|
|
4
|
1
|
|
|
1
|
|
6
|
use utf8; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
7
|
|
5
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
5948
|
use Getopt::Long 2.39; |
|
1
|
|
|
|
|
44889
|
|
|
1
|
|
|
|
|
33
|
|
7
|
1
|
|
|
1
|
|
11955
|
use Pod::Usage qw/pod2usage/; |
|
1
|
|
|
|
|
60589
|
|
|
1
|
|
|
|
|
150
|
|
8
|
|
|
|
|
|
|
|
9
|
1
|
|
|
1
|
|
602
|
use App::LLEvalBot; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub run { |
12
|
|
|
|
|
|
|
my ($class, @argv) = @_; |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
my ($opt, $rest_argv) = $class->parse_options(@argv); |
15
|
|
|
|
|
|
|
my $bot = App::LLEvalBot->new(config => $opt); |
16
|
|
|
|
|
|
|
$bot->run; |
17
|
|
|
|
|
|
|
} |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
sub parse_options { |
20
|
|
|
|
|
|
|
my ($class, @argv) = @_; |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
my $parser = Getopt::Long::Parser->new( |
23
|
|
|
|
|
|
|
config => [qw/posix_default no_ignore_case pass_through auto_help/], |
24
|
|
|
|
|
|
|
); |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
$parser->getoptionsfromarray(\@argv, \my %opt, qw/ |
27
|
|
|
|
|
|
|
host=s |
28
|
|
|
|
|
|
|
port=s |
29
|
|
|
|
|
|
|
password=s |
30
|
|
|
|
|
|
|
channels=s@ |
31
|
|
|
|
|
|
|
nickname=s |
32
|
|
|
|
|
|
|
enable-ssl |
33
|
|
|
|
|
|
|
/) or pod2usage(1); |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
my @required_options = qw/host channels/; |
36
|
|
|
|
|
|
|
pod2usage(2) if grep {!exists $opt{$_}} @required_options; |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
$opt{channels} = [ map { split /,/, $_ } @{ $opt{channels} } ]; |
39
|
|
|
|
|
|
|
$opt{join_channels} = delete $opt{channels}; |
40
|
|
|
|
|
|
|
$opt{enable_ssl} = delete $opt{'enable-ssl'} if exists $opt{'enable-ssl'}; |
41
|
|
|
|
|
|
|
$opt{nickname} //= 'lleval_bot'; |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
(\%opt, \@argv); |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
1; |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
__END__ |