| 1 | package Bot::Cobalt::IRC::Message::Public; | ||||||||||||||||||||||||||||
| 2 | 1 | $Bot::Cobalt::IRC::Message::Public::VERSION = '0.021003'; | |||||||||||||||||||||||||||
| 3 | 2 | ▶ | use v5.10; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 4 | 2 | ▶ | use strictures 2; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 5 | 2 | ▶ | use Scalar::Util 'blessed'; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||
| 7 | 2 | ▶ | use Bot::Cobalt; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 8 | 2 | ▶ | use Bot::Cobalt::Common; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||
| 10 | 1 | require Bot::Cobalt::Core; | |||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||
| 12 | 1 | ▶ | use Moo; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 13 | 1 | extends 'Bot::Cobalt::IRC::Message'; | |||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||
| 15 | 1 | has cmd => ( | |||||||||||||||||||||||||||
| 16 | lazy => 1, | ||||||||||||||||||||||||||||
| 17 | is => 'rw', | ||||||||||||||||||||||||||||
| 18 | isa => Any, | ||||||||||||||||||||||||||||
| 19 | predicate => 'has_cmd', | ||||||||||||||||||||||||||||
| 20 | builder => '_build_cmd', | ||||||||||||||||||||||||||||
| 21 | ); | ||||||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||||||
| 23 | 1 | has highlight => ( | |||||||||||||||||||||||||||
| 24 | lazy => 1, | ||||||||||||||||||||||||||||
| 25 | is => 'rw', | ||||||||||||||||||||||||||||
| 26 | isa => Bool, | ||||||||||||||||||||||||||||
| 27 | predicate => 'has_highlight', | ||||||||||||||||||||||||||||
| 28 | builder => '_build_highlight', | ||||||||||||||||||||||||||||
| 29 | ); | ||||||||||||||||||||||||||||
| 30 | |||||||||||||||||||||||||||||
| 31 | has myself => ( | ||||||||||||||||||||||||||||
| 32 | lazy => 1, | ||||||||||||||||||||||||||||
| 33 | is => 'rw', | ||||||||||||||||||||||||||||
| 34 | isa => Str, | ||||||||||||||||||||||||||||
| 35 | 0 | ▶ | builder => sub { | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=4 SCAR=30.0
| |||||||||||||||||||||||||||||
| 36 | 0 | my ($self) = @_; | |||||||||||||||||||||||||||
| 37 | 0 | my $irc; | |||||||||||||||||||||||||||
| 38 | 0 | ▶ | return '' | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
"Bot::Cobalt::Core"->has_instance and $irc = &irc_object(scalar $self->context)
MC/DC0%0/2
"Bot::Cobalt::Core"->has_instance and $irc = &irc_object(scalar $self->context)
"Bot::Cobalt::Core"->has_instance
$irc = &irc_object(scalar $self->context)
Truth table0%0/3
A and B
A= "Bot::Cobalt::Core"->has_instanceB= $irc = &irc_object(scalar $self->context)
| |||||||||||||||||||||||||||||
| 39 | unless Bot::Cobalt::Core->has_instance | ||||||||||||||||||||||||||||
| 40 | and $irc = irc_object($self->context); | ||||||||||||||||||||||||||||
| 41 | 0 | ▶ | $irc->nick_name || '' | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 42 | }, | ||||||||||||||||||||||||||||
| 43 | 1 | ); | |||||||||||||||||||||||||||
| 44 | |||||||||||||||||||||||||||||
| 45 | 0 | ▶ | after message => sub { | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=4 SCAR=30.0
| |||||||||||||||||||||||||||||
| 46 | 0 | my ($self, $value) = @_; | |||||||||||||||||||||||||||
| 47 | 0 | ▶ | return unless defined $value; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 48 | |||||||||||||||||||||||||||||
| 49 | 0 | ▶ | if ($self->has_highlight) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 50 | 0 | $self->highlight( $self->_build_highlight ); | |||||||||||||||||||||||||||
| 51 | } | ||||||||||||||||||||||||||||
| 52 | |||||||||||||||||||||||||||||
| 53 | 0 | ▶ | if ($self->has_cmd) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 54 | 0 | $self->cmd( $self->_build_cmd ); | |||||||||||||||||||||||||||
| 55 | } | ||||||||||||||||||||||||||||
| 56 | 1 | }; | |||||||||||||||||||||||||||
| 57 | |||||||||||||||||||||||||||||
| 58 | 0 | ▶ | sub _build_highlight { | ||||||||||||||||||||||||||
|
Subroutine
_build_highlight: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||
| 59 | 0 | my ($self) = @_; | |||||||||||||||||||||||||||
| 60 | 0 | ▶ | my $me = $self->myself || return 0; | ||||||||||||||||||||||||||
|
Condition0%0/2
$self->myself || (return 0)
MC/DC0%0/1
$self->myself || (return 0)
$self->myself
Truth table0%0/2
A
A= $self->myself
| |||||||||||||||||||||||||||||
| 61 | 0 | my $txt = $self->stripped; | |||||||||||||||||||||||||||
| 62 | 0 | $txt =~ /^${me}[,:;!-]?\s+/i | |||||||||||||||||||||||||||
| 63 | } | ||||||||||||||||||||||||||||
| 64 | |||||||||||||||||||||||||||||
| 65 | 0 | ▶ | sub _build_cmd { | ||||||||||||||||||||||||||
|
Subroutine
_build_cmd: not called CC=4 SCAR=30.0
| |||||||||||||||||||||||||||||
| 66 | 0 | my ($self) = @_; | |||||||||||||||||||||||||||
| 67 | |||||||||||||||||||||||||||||
| 68 | my $cmdchar = Bot::Cobalt::Core->has_instance ? | ||||||||||||||||||||||||||||
| 69 | 0 | ▶ | (core->get_core_cfg->opts->{CmdChar} // '!') : '!' | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/2
core()->get_core_cfg->opts->{"CmdChar"} // "!"
MC/DC0%0/1
core()->get_core_cfg->opts->{"CmdChar"} // "!"
core()->get_core_cfg->opts->{"CmdChar"}
Truth table0%0/2
A
A= core()->get_core_cfg->opts->{"CmdChar"}
| |||||||||||||||||||||||||||||
| 70 | ; | ||||||||||||||||||||||||||||
| 71 | |||||||||||||||||||||||||||||
| 72 | 0 | ▶ | if ($self->stripped =~ /^${cmdchar}([^\s]+)/) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 73 | 0 | my $message = $self->message_array; | |||||||||||||||||||||||||||
| 74 | 0 | shift @$message; | |||||||||||||||||||||||||||
| 75 | # shift above modifies the ref, but intentionally hit trigger: | ||||||||||||||||||||||||||||
| 76 | 0 | $self->message_array($message); | |||||||||||||||||||||||||||
| 77 | 0 | return lc($1) | |||||||||||||||||||||||||||
| 78 | } | ||||||||||||||||||||||||||||
| 79 | undef | ||||||||||||||||||||||||||||
| 80 | 0 | } | |||||||||||||||||||||||||||
| 81 | |||||||||||||||||||||||||||||
| 82 | |||||||||||||||||||||||||||||
| 83 | 1 | 1; | |||||||||||||||||||||||||||
| 84 | __END__ | ||||||||||||||||||||||||||||