| 1 | package Bot::Cobalt::Plugin::Version; | ||||||||||||
| 2 | 1 | $Bot::Cobalt::Plugin::Version::VERSION = '0.021003'; | |||||||||||
| 3 | 1 | ▶ | use strictures 2; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 4 | |||||||||||||
| 5 | 1 | ▶ | use Bot::Cobalt; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 6 | 1 | ▶ | use Bot::Cobalt::Utils 'secs_to_str'; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 7 | |||||||||||||
| 8 | 1 | ▶ | use Object::Pluggable::Constants ':ALL'; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 9 | |||||||||||||
| 10 | 1 | ▶ | sub new { bless [], shift } | ||||||||||
|
Subroutine
new: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||
| 11 | |||||||||||||
| 12 | 0 | ▶ | sub Cobalt_register { | ||||||||||
|
Subroutine
Cobalt_register: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||
| 13 | 0 | my ($self, $core) = splice @_, 0, 2; | |||||||||||
| 14 | 0 | register $self, SERVER => 'public_msg'; | |||||||||||
| 15 | 0 | logger->info("Loaded"); | |||||||||||
| 16 | 0 | PLUGIN_EAT_NONE | |||||||||||
| 17 | } | ||||||||||||
| 18 | |||||||||||||
| 19 | 0 | ▶ | sub Cobalt_unregister { | ||||||||||
|
Subroutine
Cobalt_unregister: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||
| 20 | 0 | my ($self, $core) = splice @_, 0, 2; | |||||||||||
| 21 | 0 | logger->info("Unloaded"); | |||||||||||
| 22 | 0 | PLUGIN_EAT_NONE | |||||||||||
| 23 | } | ||||||||||||
| 24 | |||||||||||||
| 25 | 0 | ▶ | sub Bot_public_msg { | ||||||||||
|
Subroutine
Bot_public_msg: not called CC=10 SCAR=47.0
Pod
undocumented
| |||||||||||||
| 26 | 0 | my ($self, $core) = splice @_, 0, 2; | |||||||||||
| 27 | 0 | my $msg = ${$_[0]}; | |||||||||||
| 28 | 0 | my $context = $msg->context; | |||||||||||
| 29 | 0 | ▶ | return PLUGIN_EAT_NONE unless $msg->highlight; | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 30 | |||||||||||||
| 31 | 0 | my $resp; | |||||||||||
| 32 | |||||||||||||
| 33 | 0 | ▶ | my $cmd = lc($msg->message_array->[1] || return PLUGIN_EAT_NONE); | ||||||||||
|
Condition0%0/2
$msg->message_array->[1] || (return 1)
MC/DC0%0/1
$msg->message_array->[1] || (return 1)
$msg->message_array->[1]
Truth table0%0/2
A
A= $msg->message_array->[1]
| |||||||||||||
| 34 | |||||||||||||
| 35 | CMD: { | ||||||||||||
| 36 | 0 | ▶ | if ($cmd eq 'info') { | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 37 | 0 | ▶ | my $startedts = $core->State->{StartedTS} // 0; | ||||||||||
|
Condition0%0/2
$core->State->{"StartedTS"} // 0
MC/DC0%0/1
$core->State->{"StartedTS"} // 0
$core->State->{"StartedTS"}
Truth table0%0/2
A
A= $core->State->{"StartedTS"}
| |||||||||||||
| 38 | 0 | my $delta = time() - $startedts; | |||||||||||
| 39 | |||||||||||||
| 40 | 0 | ▶ | my $randstuffs = $core->Provided->{randstuff_items} // 0; | ||||||||||
|
Condition0%0/2
$core->Provided->{"randstuff_items"} // 0
MC/DC0%0/1
$core->Provided->{"randstuff_items"} // 0
$core->Provided->{"randstuff_items"}
Truth table0%0/2
A
A= $core->Provided->{"randstuff_items"}
| |||||||||||||
| 41 | 0 | ▶ | my $infoglobs = $core->Provided->{info_topics} // 0; | ||||||||||
|
Condition0%0/2
$core->Provided->{"info_topics"} // 0
MC/DC0%0/1
$core->Provided->{"info_topics"} // 0
$core->Provided->{"info_topics"}
Truth table0%0/2
A
A= $core->Provided->{"info_topics"}
| |||||||||||||
| 42 | |||||||||||||
| 43 | $resp = core->rpl( q{RPL_INFO}, | ||||||||||||
| 44 | version => 'Bot::Cobalt '.$core->version, | ||||||||||||
| 45 | 0 | plugins => scalar keys %{ $core->plugin_list }, | |||||||||||
| 46 | uptime => secs_to_str($delta), | ||||||||||||
| 47 | sent => $core->State->{Counters}->{Sent}, | ||||||||||||
| 48 | 0 | topics => $infoglobs, | |||||||||||
| 49 | randstuffs => $randstuffs, | ||||||||||||
| 50 | ); | ||||||||||||
| 51 | |||||||||||||
| 52 | last CMD | ||||||||||||
| 53 | 0 | } | |||||||||||
| 54 | |||||||||||||
| 55 | 0 | ▶ | if ($cmd eq 'version') { | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 56 | 0 | $resp = core->rpl( q{RPL_VERSION}, | |||||||||||
| 57 | version => 'Bot::Cobalt '.$core->version, | ||||||||||||
| 58 | perl_v => sprintf("%vd", $^V), | ||||||||||||
| 59 | poe_v => $POE::VERSION, | ||||||||||||
| 60 | pocoirc_v => $POE::Component::IRC::VERSION, | ||||||||||||
| 61 | ); | ||||||||||||
| 62 | |||||||||||||
| 63 | last CMD | ||||||||||||
| 64 | 0 | } | |||||||||||
| 65 | |||||||||||||
| 66 | 0 | ▶ | if ($cmd eq 'os') { | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 67 | 0 | $resp = core->rpl( q{RPL_OS}, { os => $^O } ); | |||||||||||
| 68 | last CMD | ||||||||||||
| 69 | 0 | } | |||||||||||
| 70 | |||||||||||||
| 71 | 0 | return PLUGIN_EAT_NONE | |||||||||||
| 72 | } | ||||||||||||
| 73 | |||||||||||||
| 74 | 0 | ▶ | broadcast('message', $context, $msg->channel, $resp) | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 75 | if defined $resp; | ||||||||||||
| 76 | |||||||||||||
| 77 | 0 | PLUGIN_EAT_NONE | |||||||||||
| 78 | } | ||||||||||||
| 79 | |||||||||||||
| 80 | 1 | 1; | |||||||||||
| 81 | __END__ | ||||||||||||