Chatbot/Option.pm

filter: Statementstmt 81.8% 18 / 22 Branchbran 50.0% 1 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 83.3% 5 / 6 Podpod 100% 2 / 2 totaltotal 81.2% 26 / 32 SCAR 7.1
CC
2
Cov
79%
myrand
2.0
welcome_message
2.0
BEGIN
1.0
CRAP 2.0
« Chatbot/ScriptParser.pm ↑ Summary
1 package Eliza::Chatbot::Option;
2  
3 10 ▶use Moo;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 10 ▶use MooX::LazierAttributes;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 10 ▶use Eliza::Chatbot::ScriptParser;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 10 attributes (
8 [qw/script_file debug_text transform_text botprompt userprompt/] => [ rw, '', {lzy}],
9 [qw/prompts_on memory_on likelihood_of_using_memory/] => [ rw, 1, {lzy}],
10 name => [ rw, 'Eliza', {lzy}],
11 debug => [rw, 0, {lzy}],
12 max_memory_size => [rw, 5, {lzy}],
13 memory => [rw, [ ], {lzy}],
14 data => [ro, nan, {lzy, bld}]
15 );
16  
17 sub _build_data {
18 23 ▶ my $self = shift;
Subroutine _build_data: called CC=1 SCAR=0.0
19 23 my $parser = Eliza::Chatbot::ScriptParser->new(script_file => $self->script_file);
20 23 $parser->parse_script_data;
21 23 return $parser;
22 }
23  
24 sub myrand {
25 11 ▶ my ($self, $max) = @_;
Subroutine myrand: called CC=2 SCAR=7.1
Pod documented
26 11 ▶ my $n = defined $max ? $max : 1;
Branch: 1 branch
BranchTrueFalseTotal
defined $max ? : 11 0 11
27 11 return rand($n);
28 }
29  
30 sub welcome_message {
31 0 ▶ my $self = shift;
Subroutine welcome_message: not called CC=1 SCAR=6.9
Pod documented
32 0 my $initial = $self->data->initial;
33 0 return $initial->[ $self->myrand( scalar @{$initial} ) ];
34 }
35  
36 10 1;
37  
38 __END__
« Chatbot/ScriptParser.pm ↑ Summary