IRC/Ping.pm

filter: Statementstmt 66.6% 10 / 15 Branchbran 0.0% 0 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 75.0% 3 / 4 Podpod 0.0% 0 / 1 totaltotal 54.1% 13 / 24 CC 3 SCAR 18.8
CC
3
Cov
53%
__ANON__
12.0
init
1.4
BEGIN
1.0
CRAP 6.6
« IRC/Greeting.pm ↑ Summary IRC/Math.pm »
1 package Bot::IRC::Ping;
2 # ABSTRACT: Bot::IRC ping the bot and check its health
3  
4 2 ▶use 5.016;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 2 ▶use exact;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 2 our $VERSION = '1.49'; # VERSION
8  
9 1 ▶sub init {
Subroutine init: called CC=1 SCAR=3.5
Pod undocumented
10 1 my ($bot) = @_;
11  
12 $bot->hook(
13 {
14 to_me => 1,
15 text => qr/^(?<ping>ping)\b/i,
16 },
17 0 ▶ sub {
Subroutine __ANON__: not called CC=3 SCAR=24.8
18 0 my ( $bot, $in, $m ) = @_;
19 0 ▶ ( my $pong = $m->{ping} ) =~ s/(i)/ ( $1 eq 'i' ) ? 'o' : 'O' /ie;
Branch: 1 branch
BranchTrueFalseTotal
$1 eq 'i' ? : 0 0 0
20 0 my $health = $bot->health;
21  
22 $bot->reply_to(
23 "$pong. Connected to $health->{server} on port $health->{port} (" .
24 0 ▶ ( ( $health->{ssl} ) ? 'over SSL/TLS' : 'direct connection' ) . '). ' .
Branch: 1 branch
BranchTrueFalseTotal
$health->{'ssl'} ? : 0 0 0
25 "Spawned $health->{spawn} child processes. " .
26 "There are $health->{hooks} hooks and $health->{ticks} ticks " .
27 "installed via $health->{plugins} loaded plugins."
28 );
29 },
30 1 );
31  
32 1 $bot->helps( ping => 'Ping the bot and check its health. Usage: <bot> ping.' );
33 }
34  
35 2 1;
36  
37 __END__
« IRC/Greeting.pm ↑ Summary IRC/Math.pm »