Branch Coverage

blib/lib/Bot/BasicBot/Pluggable/Module/Infobot.pm
Criterion Covered Total %
branch 86 134 64.1


line true false branch
51 0 75 unless defined $body
54 0 75 if ($body =~ s/^:INFOBOT:REPLY (\S+) (.*)$//)
59 11 64 unless $mess->{'address'}
62 3 61 if ($body =~ /^forget\s+(.*)$/i)
63 3 0 unless ($self->protection_status($mess, $1))
64 2 1 $self->delete_factoid($1) ? :
71 0 61 if ($body =~ /^ask\s+(\S+)\s+about\s+(.*)$/i)
77 1 60 if ($body =~ /^tell\s+(\S+)\s+about\s+(.*)$/i)
83 6 54 if ($body =~ /^search\s+for\s+(.*)$/i)
84 1 5 unless $mess->{'channel'} eq 'msg'
85 1 4 unless $self->get('user_allow_searching')
87 1 3 unless (@results)
88 1 2 unless $#results < $self->get('user_num_results')
93 0 54 if ($self->authed($mess->{'who'}))
95 0 0 if ($body =~ /^protect\s+(.*)$/i)
96 0 0 $self->protect_factoid($1) ? :
102 0 0 if ($body =~ /^unprotect\s+(.*)$/i)
103 0 0 $self->unprotect_factoid($1) ? :
129 30 35 if ($body =~ /^(.*?)\s+(is|are)\s+(.*)$/i)
130 5 25 if $stopwords{$1}
138 0 65 $mess->{'channel'} ne 'msg' && $body =~ s/\s+\@\s+(\S+)[.]?\s*$// ? :
139 65 0 $self->get('user_require_question') && !$is_priv ? :
141 36 0 if ($body =~ s/$body_regexp// and $mess->{'address'} || $self->get('user_passive_answer') and length $body >= $self->get('user_min_length') and length $body <= $self->get('user_max_length') and not $body =~ /^(.*?)\s+(is|are)\s+(.*)$/i)
150 0 32 if (not $literal and $factoid and $factoid =~ /\|/)
156 4 32 unless ($factoid)
159 4 0 $mess->{'address'} ? :
166 0 32 if ($factoid =~ s/^<action>\s*//i) { }
4 28 elsif ($literal) { }
183 3 25 $factoid =~ s/^<reply>\s*//i ? :
187 0 32 if ($readdress)
199 3 26 unless $mess->{'address'} or $self->get('user_passive_learn')
201 2 24 unless $body =~ /^(.*?)\s+(is)\s+(.*)$/i or $body =~ /^(.*?)\s+(are)\s+(.*)$/i
208 1 23 if $object =~ s/no,?\s+//i
209 0 24 if $replace and $object =~ s/^\s*$nick,?\s*//i
212 9 15 if $description =~ s/^also\s+//i
215 0 24 if length $object < $self->get('user_min_length')
216 1 23 if length $object > $self->get('user_max_length')
217 0 276 if $object =~ /^$_\b/
221 1 22 if ($replace and not $also)
222 1 0 unless ($self->protection_status($mess, $object))
232 2 21 if ($current and not $also and $mess->{'address'}) { }
2 28 elsif ($current and not $also and not $mess->{'address'}) { }
239 19 0 unless ($self->protection_status($mess, $object))
244 19 0 $mess->{'address'} ? :
256 14 46 unless @factoids
266 0 125 if $_->{'text'} =~ /^\s*$/
267 25 100 if ($_->{'alternate'} or $_->{'alt'}) { }
275 4 42 if ($literal)
283 42 0 if @simple
304 24 55 unless my $raw = $self->get('infobot_' . lc($object))
310 55 0 if (ref $raw) { }
315 0 144 ref $_ && /DBM::Deep::Hash/ ? :
316 0 55 unless $raw->{'factoids'}
325 0 0 $text =~ s/^\|\s*// ? :
340 9 10 if $current_is_are
345 3 17 s/^\|\s*// ? :
368 0 23 if $self->get('ibprot_' . lc($object))
373 3 1 if ($self->get($key)) { }
385 0 0 if ($self->get($key)) { }
397 0 0 if ($self->get($key)) { }
442 5 0 $term =~ s/^${\'infobot_';}// ? :
461 2 0 if ($response->is_success) { }
462 2 0 unless $feed = 'XML::Feed'->parse(\$response->content)
470 0 0 if ($max_items and $max_items < @entries)
475 2 0 if ($@)
489 0 0 $ret =~ /^<(reply|action)>/ ? :
498 0 0 unless my $infobot_data = $self->{'remote_infobot'}{$id}