| 1 | package POE::Component::IRC::Plugin::BaseWrap; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | 2 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | 2 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | 2 | our $VERSION = '1.001002'; # VERSION | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | 2 | ▶ | use Carp; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | 2 | ▶ | use POE; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | 2 | ▶ | use POE::Component::IRC::Plugin qw(:ALL); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | 0 | ▶ | sub new { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: not called CC=14 SCAR=53.5
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | 0 | my $package = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | 0 | ▶ | croak "Even number of arguments must be specified" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | if @_ & 1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | 0 | my %args = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | 0 | $args{ lc $_ } = delete $args{ $_ } for keys %args; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | 0 | my $self = bless {}, $package; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | # fill in the defaults | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | 0 | %args = ( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | debug => 0, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | auto => 1, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | response_event => 'irc_basewrap', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | banned => [], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | addressed => 1, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | eat => 1, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | response_types => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | public => 'public', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | privmsg => 'privmsg', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | notice => 'notice', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | listen_for_input => [ qw(public notice privmsg) ], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | $self->_make_default_args, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | %args, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | 0 | ▶ | $args{response_types}{public} ||= 'public'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$args{"response_types"}{"public"} ||= "public"
MC/DC0%0/1
$args{"response_types"}{"public"} ||= "public"
$args{"response_types"}{"public"}
Truth table0%0/2
A
A= $args{"response_types"}{"public"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | 0 | ▶ | $args{response_types}{privmsg} ||= 'privmsg'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$args{"response_types"}{"privmsg"} ||= "privmsg"
MC/DC0%0/1
$args{"response_types"}{"privmsg"} ||= "privmsg"
$args{"response_types"}{"privmsg"}
Truth table0%0/2
A
A= $args{"response_types"}{"privmsg"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | 0 | ▶ | $args{response_types}{notice} ||= 'notice'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$args{"response_types"}{"notice"} ||= "notice"
MC/DC0%0/1
$args{"response_types"}{"notice"} ||= "notice"
$args{"response_types"}{"notice"}
Truth table0%0/2
A
A= $args{"response_types"}{"notice"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | $args{listen_for_input} = { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | 0 | ▶ | map { $_ => 1 } @{ $args{listen_for_input} || [] } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$args{'listen_for_input'} || []
MC/DC0%0/1
$args{'listen_for_input'} || []
$args{'listen_for_input'}
Truth table0%0/2
A
A= $args{'listen_for_input'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | 0 | for ( keys %{ $args{triggers} } ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | 0 | ▶ | if ( $_ ne 'public' and $_ ne 'notice' and $_ ne 'privmsg' ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
$_ ne "public" and $_ ne "notice" and $_ ne "privmsg"
$_ ne "public" and $_ ne "notice"
MC/DC0%0/3
$_ ne "public" and $_ ne "notice" and $_ ne "privmsg"
$_ ne "public"
$_ ne "notice"
$_ ne "privmsg"
Truth table0%0/4
A and B and C
A= $_ ne "public"B= $_ ne "notice"C= $_ ne "privmsg"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | 0 | croak "Invalid key [$_] in {triggers}, must be either" | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | . " 'public', 'privmsg' or 'notice'"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | 0 | ▶ | if ( not exists $args{trigger} and ref $args{triggers} ne 'HASH' ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
not exists $args{"trigger"} and ref $args{"triggers"} ne "HASH"
MC/DC0%0/2
not exists $args{"trigger"} and ref $args{"triggers"} ne "HASH"
not exists $args{"trigger"}
ref $args{"triggers"} ne "HASH"
Truth table0%0/3
not(A) and B
A= not exists $args{"trigger"}B= ref $args{"triggers"} ne "HASH"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | 0 | croak "Neither 'trigger' nor 'triggers' arguments were specified"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | 0 | $self->{ $_ } = delete $args{ $_ } for keys %args; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | 0 | return $self; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | 0 | ▶ | sub PCI_register { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
PCI_register: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | 0 | my ( $self, $irc ) = splice @_, 0, 2; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 66 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 67 | 0 | $self->{irc} = $irc; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 68 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 69 | 0 | $irc->plugin_register( $self, 'SERVER', qw(public notice msg) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 70 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 71 | 0 | return 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 72 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 73 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 74 | 0 | ▶ | sub PCI_unregister { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
PCI_unregister: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 75 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 76 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 77 | 0 | delete $self->{irc}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 78 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 79 | 0 | return 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 80 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 81 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 82 | 0 | ▶ | sub S_public { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
S_public: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 83 | 0 | my ( $self, $irc ) = splice @_, 0, 2; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 84 | 0 | my $who = ${ $_[0] }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 85 | 0 | my $channel = ${ $_[1] }->[0]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 86 | 0 | my $message = ${ $_[2] }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 87 | 0 | return $self->_parse_input( $irc, $who, $channel, $message, 'public' ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 88 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 89 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 90 | 0 | ▶ | sub S_notice { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
S_notice: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 91 | 0 | my ( $self, $irc ) = splice @_, 0, 2; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 92 | 0 | my $who = ${ $_[0] }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 93 | 0 | my $channel = ${ $_[1] }->[0]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 94 | 0 | my $message = ${ $_[2] }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 95 | 0 | return $self->_parse_input( $irc, $who, $channel, $message, 'notice' ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 96 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 97 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 98 | 0 | ▶ | sub S_msg { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
S_msg: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 99 | 0 | my ( $self, $irc ) = splice @_, 0, 2; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 100 | 0 | my $who = ${ $_[0] }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 101 | 0 | my $channel = ${ $_[1] }->[0]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 102 | 0 | my $message = ${ $_[2] }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 103 | 0 | return $self->_parse_input( $irc, $who, $channel, $message, 'privmsg' ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 104 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 105 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 106 | 0 | ▶ | sub _parse_input { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_parse_input: not called CC=18 SCAR=58.3
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 107 | 0 | my ( $self, $irc, $who, $channel, $message, $type ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 108 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 109 | warn "Got input: [ who => $who, channel => $channel, " | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 110 | . "mesage => $message ]" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 111 | 0 | ▶ | if $self->{debug}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 112 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 113 | return PCI_EAT_NONE | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 114 | 0 | ▶ | unless exists $self->{listen_for_input}{ $type }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 115 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 116 | 0 | my $what; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 117 | 0 | ▶ | if ( $self->{addressed} and $type eq 'public' ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$self->{"addressed"} and $type eq "public"
MC/DC0%0/2
$self->{"addressed"} and $type eq "public"
$self->{"addressed"}
$type eq "public"
Truth table0%0/3
A and B
A= $self->{"addressed"}B= $type eq "public"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 118 | 0 | my $my_nick = $irc->nick_name(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 119 | 0 | ($what) = $message =~ m/^\s*\Q$my_nick\E[\:\,\;\.]?\s*(.*)$/i; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 120 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 121 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 122 | 0 | $what = $message; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 123 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 124 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 125 | 0 | ▶ | return PCI_EAT_NONE | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 126 | unless defined $what; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 127 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 128 | return PCI_EAT_NONE | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 129 | unless ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 130 | ( exists $self->{triggers}{ $type } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 131 | and $what =~ s/$self->{triggers}{$type}// | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 132 | ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 133 | or | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 134 | 0 | ▶ | ( exists $self->{trigger} and $what =~ s/$self->{trigger}// ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/9
exists $self->{"triggers"}{$type} and $what =~ s/$self->{"triggers"}{$type}// or exists $self->{"trigger"} and $what =~ s/$self->{"trigger"}//
exists $self->{"triggers"}{$type} and $what =~ s/$self->{"triggers"}{$type}//
exists $self->{"trigger"} and $what =~ s/$self->{"trigger"}//
MC/DC0%0/4
exists $self->{"triggers"}{$type} and $what =~ s/$self->{"triggers"}{$type}// or exists $self->{"trigger"} and $what =~ s/$self->{"trigger"}//
exists $self->{"triggers"}{$type}
$what =~ s/$self->{"triggers"}{$type}//
exists $self->{"trigger"}
$what =~ s/$self->{"trigger"}//
Truth table0%0/7
A and B or C and D
A= exists $self->{"triggers"}{$type}B= $what =~ s/$self->{"triggers"}{$type}//C= exists $self->{"trigger"}D= $what =~ s/$self->{"trigger"}//
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 135 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 136 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 137 | 0 | $what =~ s/^\s+|\s+$//g; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 138 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 139 | warn "Matched trigger: [ who => $who, channel => $channel, " | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 140 | . "what => $what ]" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 141 | 0 | ▶ | if $self->{debug}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 142 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 143 | 0 | ▶ | if ( exists $self->{root} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 144 | return PCI_EAT_NONE | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 145 | 0 | ▶ | unless grep { $who =~ /$_/ } @{ $self->{root} || [] }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/2
$self->{'root'} || []
MC/DC0%0/1
$self->{'root'} || []
$self->{'root'}
Truth table0%0/2
A
A= $self->{'root'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 146 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 147 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 148 | 0 | ▶ | foreach my $ban_re ( @{ $self->{banned} || [] } ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$self->{'banned'} || []
MC/DC0%0/1
$self->{'banned'} || []
$self->{'banned'}
Truth table0%0/2
A
A= $self->{'banned'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 149 | 0 | ▶ | return PCI_EAT_NONE | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 150 | if $who =~ /$ban_re/; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 151 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 152 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 153 | $self->_do_response( { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 154 | 0 | what => $what, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 155 | who => $who, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 156 | channel => $channel, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 157 | message => $message, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 158 | type => $type, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 159 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 160 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 161 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 162 | 0 | ▶ | return $self->{eat} ? PCI_EAT_ALL : PCI_EAT_NONE; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 163 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 164 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 165 | 0 | ▶ | sub _do_response { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_do_response: not called CC=8 SCAR=42.8
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 166 | 0 | my ( $self, $in_ref ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 167 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 168 | 0 | my $response_message = $self->_make_response_message( $in_ref ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 169 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 170 | 0 | my $event_response; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 171 | 0 | ▶ | if ( my $key = $self->_message_into_response_event( $in_ref ) ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 172 | 0 | ▶ | if ( ref $key eq 'ARRAY' ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 173 | 0 | $in_ref->{ $key->[0] } = $response_message; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 174 | %$in_ref = ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 175 | %$in_ref, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 176 | 0 | %{ $key->[1] }, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 177 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 178 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 179 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 180 | 0 | $in_ref->{ $key } = $response_message; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 181 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 182 | 0 | $event_response = $in_ref; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 183 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 184 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 185 | 0 | $event_response = $self->_make_response_event( $in_ref ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 186 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 187 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 188 | $self->{irc}->send_event( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 189 | 0 | $self->{response_event} => $event_response, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 190 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 191 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 192 | 0 | ▶ | if ( $self->{auto} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 193 | 0 | $in_ref->{type} = $self->{response_types}{ $in_ref->{type} }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 194 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 195 | my $response_type = $in_ref->{type} eq 'public' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 196 | ? 'privmsg' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 197 | 0 | ▶ | : $in_ref->{type}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 198 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 199 | my $where = $in_ref->{type} eq 'public' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 200 | ? $in_ref->{channel} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 201 | 0 | ▶ | : (split /!/, $in_ref->{who})[0]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 202 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 203 | 0 | ▶ | for ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 204 | ref $response_message eq 'ARRAY' ? @$response_message | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 205 | : ( $response_message ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 206 | ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 207 | $poe_kernel->post( $self->{irc} => | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 208 | 0 | $response_type => | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 209 | $where => | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 210 | $_ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 211 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 212 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 213 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 214 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 215 | 0 | undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 216 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 217 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 218 | 0 | ▶ | sub _message_into_response_event { undef; } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_message_into_response_event: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 219 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 220 | 2 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 221 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 222 | __END__ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||