Client/Item/Var.pm

filter: Statementstmt 100% 33 / 33 Branchbran 75.0% 3 / 4 Conditioncond 66.6% 2 / 3 MC/DCmcdc 50.0% 1 / 2 Subroutinesub 100% 7 / 7 Podpod 50.0% 1 / 2 totaltotal 92.1% 47 / 51 CC 4 SCAR 5.9
CC
4
Cov
95%
execute
3.0
init
2.0
BEGIN
1.0
CRAP 1.8
« Client/Item/NoInput.pm ↑ Summary Client/Engine/Component/Interpreter/Context.pm »
1  
2 package VoiceXML::Client::Item::Var;
3  
4  
5 3 ▶use base qw (VoiceXML::Client::Item);
Subroutine BEGIN: called CC=1 SCAR=0.0
6 3 ▶use VoiceXML::Client::Util;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 3 ▶use VoiceXML::Client::Item::Util;
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9  
10 =head1 COPYRIGHT AND LICENSE
11  
12
13 Copyright (C) 2007,2008 by Pat Deegan.
14 All rights reserved
15 http://voicexml.psychogenic.com
16  
17 This library is released under the terms of the GNU GPL version 3, making it available only for
18 free programs ("free" here being used in the sense of the GPL, see http://www.gnu.org for more details).
19 Anyone wishing to use this library within a proprietary or otherwise non-GPLed program MUST contact psychogenic.com to
20 acquire a distinct license for their application. This approach encourages the use of free software
21 while allowing for proprietary solutions that support further development.
22  
23  
24 This file is part of VoiceXML::Client.
25  
26
27
28 VoiceXML::Client is free software: you can redistribute it and/or modify
29 it under the terms of the GNU General Public License as published by
30 the Free Software Foundation, either version 3 of the License, or
31 (at your option) any later version.
32  
33 VoiceXML::Client is distributed in the hope that it will be useful,
34 but WITHOUT ANY WARRANTY; without even the implied warranty of
35 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
36 GNU General Public License for more details.
37  
38 You should have received a copy of the GNU General Public License
39 along with VoiceXML::Client. If not, see <http://www.gnu.org/licenses/>.
40  
41  
42 =cut
43  
44  
45  
46 3 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
47  
48 3 ▶use vars qw{
Subroutine BEGIN: called CC=1 SCAR=0.0
49 $VERSION
50 3 };
51  
52 3 $VERSION = $VoiceXML::Client::Item::VERSION;
53  
54  
55  
56  
57 6 ▶sub init {
Subroutine init: called CC=2 SCAR=7.0
Pod documented
58 6 my $self = shift;
59
60 6 my $name = $self->{'XMLElement'}->attribute('name');
61 6 my $val = $self->{'XMLElement'}->attribute('expr');
62  
63 6 ▶ return undef unless (defined $name);
Branch: 1 branch
BranchTrueFalseTotal
unless defined $name 0 6 6
64
65 6 my $vxmlDoc = $self->getParentVXMLDocument()->registerVariable($name);
66
67
68 6 $self->{'name'} = $name;
69 6 $self->{'expr'} = $val;
70
71 6 return 1;
72
73
74 }
75  
76 6 ▶sub execute {
Subroutine execute: called CC=3 SCAR=11.0
Pod undocumented
77 6 my $self = shift;
78 6 my $handle = shift;
79 6 my $optParams = shift;
80
81 6 my $vxmlDoc = $self->getParentVXMLDocument();
82 6 VoiceXML::Client::Item::Util->declareVariable($self, $self->{'name'}, $vxmlDoc);
83 6 ▶ if (defined $self->{'expr'} && length($self->{'expr'}))
Branch: 1 branch
BranchTrueFalseTotal
if (defined $self->{"expr"} and length $self->{"expr"}) 2 4 6
Condition66%2/3
defined $self->{"expr"} and length $self->{"expr"}
!ll&&!rl&&r
042
MC/DC50%1/2
defined $self->{"expr"} and length $self->{"expr"}
defined $self->{"expr"} length $self->{"expr"}
Truth table66%2/3
A and B
A= defined $self->{"expr"}B= length $self->{"expr"}
ABresult
0X0
100
111
84 {
85 2 VoiceXML::Client::Item::Util->assignVariable($self, $self->{'name'}, $self->{'expr'}, $vxmlDoc);
86 }
87
88
89 6 return $self->executeChildren($handle, $optParams);
90 }
91
92  
93  
94  
95 3 1;
« Client/Item/NoInput.pm ↑ Summary Client/Engine/Component/Interpreter/Context.pm »