blib/lib/SignalWire/Skills/Builtin/CustomSkills.pm

filter: Statementstmt 100% 31 / 31 Branchbran 83.3% 5 / 6 Conditioncond 100% 2 / 2 MC/DCmcdc 100% 1 / 1 Subroutinesub 100% 10 / 10 Podpod 0.0% 0 / 3 totaltotal 92.4% 49 / 53 CC 6 SCAR 11.0
CC
6
Cov
97%
register_tools
6.0
BEGIN
1.0
BEGIN
1.0
CRAP 3.0
« blib/lib/SignalWire/Skills/Builtin/InfoGatherer.pm ↑ Summary blib/lib/SignalWire/Prefabs/Survey.pm »
1 package SignalWire::Skills::Builtin::CustomSkills;
2 4 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 4 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 4 ▶use Moo;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 4 extends 'SignalWire::Skills::SkillBase';
6  
7 4 ▶use SignalWire::Skills::SkillRegistry;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 4 SignalWire::Skills::SkillRegistry->register_skill('custom_skills', __PACKAGE__);
9  
10 8 ▶has '+skill_name' => (default => sub { 'custom_skills' });
Subroutine __ANON__: called CC=1 SCAR=0.0
11 8 ▶has '+skill_description' => (default => sub { 'Register user-defined custom tools' });
Subroutine __ANON__: called CC=1 SCAR=0.0
12 8 ▶has '+supports_multiple_instances' => (default => sub { 1 });
Subroutine __ANON__: called CC=1 SCAR=0.0
13  
14 7 ▶sub setup { 1 }
Subroutine setup: called CC=1 SCAR=0.0
Pod undocumented
15  
16 6 ▶sub register_tools {
Subroutine register_tools: called CC=6 SCAR=17.9
Pod undocumented
17 6 my ($self) = @_;
18 6 ▶ my $tools = $self->params->{tools} // [];
Condition100%2/2
$self->params->{"tools"} // []
l!l
51
MC/DC100%1/1
$self->params->{"tools"} // []
$self->params->{"tools"}
Truth table100%2/2
A
A= $self->params->{"tools"}
Aresult
11
00
19  
20 6 for my $tool_def (@$tools) {
21 7 ▶ next unless ref $tool_def eq 'HASH';
Branch: 1 branch
BranchTrueFalseTotal
unless ref $tool_def eq "HASH" 2 5 7
22 5 ▶ if (exists $tool_def->{function}) {
Branch: 2 branches
BranchTrueFalseTotal
if (exists $tool_def->{'function'}) { } 2 3 5
elsif (exists $tool_def->{'name'}) { } 3 0 3
23 2 $self->agent->register_swaig_function($tool_def);
24 } elsif (exists $tool_def->{name}) {
25 3 $self->agent->define_tool(%$tool_def);
26 }
27 }
28 }
29  
30 1 ▶sub get_parameter_schema {
Subroutine get_parameter_schema: called CC=1 SCAR=0.0
Pod undocumented
31 return {
32 1 %{ SignalWire::Skills::SkillBase->get_parameter_schema },
33 tools => { type => 'array', description => 'Array of tool definition objects' },
34 };
35 }
36  
37 4 1;
« blib/lib/SignalWire/Skills/Builtin/InfoGatherer.pm ↑ Summary blib/lib/SignalWire/Prefabs/Survey.pm »