Client/Item/Record.pm

filter: Statementstmt 45.7% 16 / 35 Branchbran 0.0% 0 / 4 Conditioncond 0.0% 0 / 15 MC/DCmcdc 0.0% 0 / 8 Subroutinesub 66.6% 4 / 6 Podpod 50.0% 1 / 2 totaltotal 30.0% 21 / 70 CC 10 SCAR 34.6
CC
10
Cov
30%
init
56.0
execute
20.0
BEGIN
1.0
CRAP 31.7
« Client/Item/Grammar/Rule.pm ↑ Summary Client/Engine/Component/Interpreter/Perl.pm »
1  
2 package VoiceXML::Client::Item::Record;
3  
4  
5 3 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 3 ▶use base qw (VoiceXML::Client::Item);
Subroutine BEGIN: called CC=1 SCAR=0.0
8 3 ▶use VoiceXML::Client::Util;
Subroutine BEGIN: called CC=1 SCAR=0.0
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  
47 3 ▶use vars qw{
Subroutine BEGIN: called CC=1 SCAR=0.0
48 $BeepFrequency
49 $BeepMilliseconds
50 $VERSION
51 3 };
52  
53 3 $BeepFrequency = 400;
54 3 $BeepMilliseconds = 1000;
55  
56 3 $VERSION = $VoiceXML::Client::Item::VERSION;
57  
58  
59  
60  
61  
62 0 ▶sub init {
Subroutine init: not called CC=7 SCAR=40.3
Pod documented
63 0 my $self = shift;
64
65 0 ▶ $self->{'name'} = $self->{'XMLElement'}->attribute('name') || warn "No record name specified";
Condition0%0/2
$self->{'XMLElement'}->attribute('name') || warn('No record name specified')
l!l
00
MC/DC0%0/1
$self->{'XMLElement'}->attribute('name') || warn('No record name specified')
$self->{'XMLElement'}->attribute('name')
Truth table0%0/2
A
A= $self->{'XMLElement'}->attribute('name')
Aresult
11
00
66 0 ▶ $self->{'beep'} = $self->{'XMLElement'}->attribute('beep') || 'true';
Condition0%0/2
$self->{'XMLElement'}->attribute('beep') || 'true'
l!l
00
MC/DC0%0/1
$self->{'XMLElement'}->attribute('beep') || 'true'
$self->{'XMLElement'}->attribute('beep')
Truth table0%0/2
A
A= $self->{'XMLElement'}->attribute('beep')
Aresult
11
00
67 0 ▶ $self->{'maxtime'} = $self->{'XMLElement'}->attribute('maxtime') || '10s';
Condition0%0/2
$self->{'XMLElement'}->attribute('maxtime') || '10s'
l!l
00
MC/DC0%0/1
$self->{'XMLElement'}->attribute('maxtime') || '10s'
$self->{'XMLElement'}->attribute('maxtime')
Truth table0%0/2
A
A= $self->{'XMLElement'}->attribute('maxtime')
Aresult
11
00
68 0 ▶ $self->{'dtmfterm'} = $self->{'XMLElement'}->attribute('dtmfterm') || 'true';
Condition0%0/2
$self->{'XMLElement'}->attribute('dtmfterm') || 'true'
l!l
00
MC/DC0%0/1
$self->{'XMLElement'}->attribute('dtmfterm') || 'true'
$self->{'XMLElement'}->attribute('dtmfterm')
Truth table0%0/2
A
A= $self->{'XMLElement'}->attribute('dtmfterm')
Aresult
11
00
69 0 ▶ $self->{'finalsilence'} = $self->{'XMLElement'}->attribute('finalsilence') || '4000ms';
Condition0%0/2
$self->{'XMLElement'}->attribute('finalsilence') || '4000ms'
l!l
00
MC/DC0%0/1
$self->{'XMLElement'}->attribute('finalsilence') || '4000ms'
$self->{'XMLElement'}->attribute('finalsilence')
Truth table0%0/2
A
A= $self->{'XMLElement'}->attribute('finalsilence')
Aresult
11
00
70 0 ▶ $self->{'type'} = $self->{'XMLElement'}->attribute('type') || 'audio/x-wav';
Condition0%0/2
$self->{'XMLElement'}->attribute('type') || 'audio/x-wav'
l!l
00
MC/DC0%0/1
$self->{'XMLElement'}->attribute('type') || 'audio/x-wav'
$self->{'XMLElement'}->attribute('type')
Truth table0%0/2
A
A= $self->{'XMLElement'}->attribute('type')
Aresult
11
00
71
72
73 0 return 1;
74
75
76 }
77  
78  
79 0 ▶sub execute {
Subroutine execute: not called CC=4 SCAR=30.0
Pod undocumented
80 0 my $self = shift;
81 0 my $handle = shift;
82 0 my $optParams = shift;
83
84 0 ▶ unless ($self->{'name'})
Branch: 1 branch
BranchTrueFalseTotal
unless ($self->{"name"}) 0 0 0
85 {
86 0 warn "Record::execute called but no name set?";
87
88 0 return $VoiceXML::Client::Flow::Directive{'ABORT'};
89 }
90
91 0 ▶ if ($self->{'beep'} && $self->{'beep'} =~ m/true/i)
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"beep"} and $self->{"beep"} =~ /true/i) 0 0 0
Condition0%0/3
$self->{"beep"} and $self->{"beep"} =~ /true/i
!ll&&!rl&&r
000
MC/DC0%0/2
$self->{"beep"} and $self->{"beep"} =~ /true/i
$self->{"beep"} $self->{"beep"} =~ /true/i
Truth table0%0/3
A and B
A= $self->{"beep"}B= $self->{"beep"} =~ /true/i
ABresult
0X0
100
111
92 {
93 0 $handle->beep($BeepFrequency, $BeepMilliseconds);
94 }
95
96 0 $handle->record($self->{'name'});
97
98 0 chmod 0666, $self->{'name'};
99
100 0 return $self->executeChildren($handle, $optParams);
101 }
102
103  
104 3 1;
« Client/Item/Grammar/Rule.pm ↑ Summary Client/Engine/Component/Interpreter/Perl.pm »