| 1 | |||||||||||||||||||||||||||||
| 2 | package VoiceXML::Client::Item::Prompt; | ||||||||||||||||||||||||||||
| 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 | |||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||
| 9 | =head1 COPYRIGHT AND LICENSE | ||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||
| 12 | Copyright (C) 2007,2008 by Pat Deegan. | ||||||||||||||||||||||||||||
| 13 | All rights reserved | ||||||||||||||||||||||||||||
| 14 | http://voicexml.psychogenic.com | ||||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||
| 16 | This library is released under the terms of the GNU GPL version 3, making it available only for | ||||||||||||||||||||||||||||
| 17 | free programs ("free" here being used in the sense of the GPL, see http://www.gnu.org for more details). | ||||||||||||||||||||||||||||
| 18 | Anyone wishing to use this library within a proprietary or otherwise non-GPLed program MUST contact psychogenic.com to | ||||||||||||||||||||||||||||
| 19 | acquire a distinct license for their application. This approach encourages the use of free software | ||||||||||||||||||||||||||||
| 20 | while allowing for proprietary solutions that support further development. | ||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||||||
| 23 | This file is part of VoiceXML::Client. | ||||||||||||||||||||||||||||
| 24 | |||||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||
| 26 | |||||||||||||||||||||||||||||
| 27 | VoiceXML::Client is free software: you can redistribute it and/or modify | ||||||||||||||||||||||||||||
| 28 | it under the terms of the GNU General Public License as published by | ||||||||||||||||||||||||||||
| 29 | the Free Software Foundation, either version 3 of the License, or | ||||||||||||||||||||||||||||
| 30 | (at your option) any later version. | ||||||||||||||||||||||||||||
| 31 | |||||||||||||||||||||||||||||
| 32 | VoiceXML::Client is distributed in the hope that it will be useful, | ||||||||||||||||||||||||||||
| 33 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||||||||||||||||||||||||||
| 34 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||||||||||||||||||||||||||||
| 35 | GNU General Public License for more details. | ||||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||
| 37 | You should have received a copy of the GNU General Public License | ||||||||||||||||||||||||||||
| 38 | along with VoiceXML::Client. If not, see <http://www.gnu.org/licenses/>. | ||||||||||||||||||||||||||||
| 39 | |||||||||||||||||||||||||||||
| 40 | |||||||||||||||||||||||||||||
| 41 | =cut | ||||||||||||||||||||||||||||
| 42 | |||||||||||||||||||||||||||||
| 43 | |||||||||||||||||||||||||||||
| 44 | |||||||||||||||||||||||||||||
| 45 | 3 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 46 | |||||||||||||||||||||||||||||
| 47 | |||||||||||||||||||||||||||||
| 48 | 3 | ▶ | use vars qw{ | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 49 | $VERSION | ||||||||||||||||||||||||||||
| 50 | $DefaultTimeoutSeconds | ||||||||||||||||||||||||||||
| 51 | 3 | }; | |||||||||||||||||||||||||||
| 52 | |||||||||||||||||||||||||||||
| 53 | 3 | $VERSION = $VoiceXML::Client::Item::VERSION; | |||||||||||||||||||||||||||
| 54 | |||||||||||||||||||||||||||||
| 55 | 3 | $DefaultTimeoutSeconds = 7; | |||||||||||||||||||||||||||
| 56 | |||||||||||||||||||||||||||||
| 57 | 4 | ▶ | sub init { | ||||||||||||||||||||||||||
|
Subroutine
init: called CC=6 SCAR=20.9
Pod
documented
| |||||||||||||||||||||||||||||
| 58 | 4 | my $self = shift; | |||||||||||||||||||||||||||
| 59 | |||||||||||||||||||||||||||||
| 60 | 4 | ▶ | my $timeout = $self->{'XMLElement'}->attribute('timeout') || $DefaultTimeoutSeconds; | ||||||||||||||||||||||||||
|
Condition66%2/3
$self->{'XMLElement'}->attribute('timeout') || $VoiceXML::Client::Item::Prompt::DefaultTimeoutSeconds
MC/DC0%0/2
$self->{'XMLElement'}->attribute('timeout') || $VoiceXML::Client::Item::Prompt::DefaultTimeoutSeconds
$self->{'XMLElement'}->attribute('timeout')
$VoiceXML::Client::Item::Prompt::DefaultTimeoutSeconds
Truth table66%2/3
A || B
A= $self->{'XMLElement'}->attribute('timeout')B= $VoiceXML::Client::Item::Prompt::DefaultTimeoutSeconds
| |||||||||||||||||||||||||||||
| 61 | |||||||||||||||||||||||||||||
| 62 | 4 | ▶ | if ($timeout =~ m/^\s*(\d+)(\w+)/) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 63 | { | ||||||||||||||||||||||||||||
| 64 | 1 | my $timeVal = $1; | |||||||||||||||||||||||||||
| 65 | 1 | my $timeUnit = $2; | |||||||||||||||||||||||||||
| 66 | 1 | ▶ | if ($timeUnit eq 's') | ||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||
| 67 | { | ||||||||||||||||||||||||||||
| 68 | 1 | $timeout = $1; | |||||||||||||||||||||||||||
| 69 | } elsif ($timeUnit eq 'ms') | ||||||||||||||||||||||||||||
| 70 | { | ||||||||||||||||||||||||||||
| 71 | 0 | $timeout = int($timeVal / 1000); | |||||||||||||||||||||||||||
| 72 | |||||||||||||||||||||||||||||
| 73 | } else { | ||||||||||||||||||||||||||||
| 74 | 0 | VoiceXML::Client::Util::log_msg("Invalid prompt timeout time unit $timeUnit -- defaulting to $DefaultTimeoutSeconds seconds"); | |||||||||||||||||||||||||||
| 75 | 0 | $timeout = $DefaultTimeoutSeconds; | |||||||||||||||||||||||||||
| 76 | } | ||||||||||||||||||||||||||||
| 77 | |||||||||||||||||||||||||||||
| 78 | 1 | ▶ | if ($timeout < 1) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 79 | { | ||||||||||||||||||||||||||||
| 80 | 0 | VoiceXML::Client::Util::log_msg("Timeout for prompt too small ($timeout) -- defaulting to 1s"); | |||||||||||||||||||||||||||
| 81 | 0 | $timeout = 1; | |||||||||||||||||||||||||||
| 82 | } | ||||||||||||||||||||||||||||
| 83 | } | ||||||||||||||||||||||||||||
| 84 | |||||||||||||||||||||||||||||
| 85 | 4 | $self->{'timeoutseconds'} = $timeout; | |||||||||||||||||||||||||||
| 86 | |||||||||||||||||||||||||||||
| 87 | |||||||||||||||||||||||||||||
| 88 | 4 | return 1; | |||||||||||||||||||||||||||
| 89 | |||||||||||||||||||||||||||||
| 90 | } | ||||||||||||||||||||||||||||
| 91 | |||||||||||||||||||||||||||||
| 92 | 0 | ▶ | sub timeoutSeconds { | ||||||||||||||||||||||||||
|
Subroutine
timeoutSeconds: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||
| 93 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 94 | 0 | my $setTo = shift; | |||||||||||||||||||||||||||
| 95 | |||||||||||||||||||||||||||||
| 96 | 0 | ▶ | if (defined $setTo && $setTo =~ m/^\d+$/) | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
defined $setTo and $setTo =~ /^\d+$/
MC/DC0%0/2
defined $setTo and $setTo =~ /^\d+$/
defined $setTo
$setTo =~ /^\d+$/
Truth table0%0/3
A and B
A= defined $setToB= $setTo =~ /^\d+$/
| |||||||||||||||||||||||||||||
| 97 | { | ||||||||||||||||||||||||||||
| 98 | 0 | $self->{'timeoutseconds'} = $setTo; | |||||||||||||||||||||||||||
| 99 | } | ||||||||||||||||||||||||||||
| 100 | |||||||||||||||||||||||||||||
| 101 | 0 | return $self->{'timeoutseconds'}; | |||||||||||||||||||||||||||
| 102 | } | ||||||||||||||||||||||||||||
| 103 | |||||||||||||||||||||||||||||
| 104 | 3 | 1; | |||||||||||||||||||||||||||