| 1 | |||||||||||||
| 2 | package VoiceXML::Client::Item::Submit; | ||||||||||||
| 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 | 3 | ▶ | use vars qw{ | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 48 | $VERSION | ||||||||||||
| 49 | 3 | }; | |||||||||||
| 50 | |||||||||||||
| 51 | 3 | $VERSION = $VoiceXML::Client::Item::VERSION; | |||||||||||
| 52 | |||||||||||||
| 53 | |||||||||||||
| 54 | |||||||||||||
| 55 | 2 | ▶ | sub init { | ||||||||||
|
Subroutine
init: called CC=6 SCAR=18.5
Pod
documented
| |||||||||||||
| 56 | 2 | my $self = shift; | |||||||||||
| 57 | |||||||||||||
| 58 | 2 | ▶ | $self->{'next'} = $self->{'XMLElement'}->attribute('next') || ''; | ||||||||||
|
Condition50%1/2
$self->{'XMLElement'}->attribute('next') || ''
MC/DC0%0/1
$self->{'XMLElement'}->attribute('next') || ''
$self->{'XMLElement'}->attribute('next')
Truth table50%1/2
A
A= $self->{'XMLElement'}->attribute('next')
| |||||||||||||
| 59 | 2 | ▶ | $self->{'namelist'} = $self->{'XMLElement'}->attribute('namelist') || ''; | ||||||||||
|
Condition50%1/2
$self->{'XMLElement'}->attribute('namelist') || ''
MC/DC0%0/1
$self->{'XMLElement'}->attribute('namelist') || ''
$self->{'XMLElement'}->attribute('namelist')
Truth table50%1/2
A
A= $self->{'XMLElement'}->attribute('namelist')
| |||||||||||||
| 60 | 2 | ▶ | $self->{'method'} = $self->{'XMLElement'}->attribute('method') || 'get'; | ||||||||||
|
Condition50%1/2
$self->{'XMLElement'}->attribute('method') || 'get'
MC/DC0%0/1
$self->{'XMLElement'}->attribute('method') || 'get'
$self->{'XMLElement'}->attribute('method')
Truth table50%1/2
A
A= $self->{'XMLElement'}->attribute('method')
| |||||||||||||
| 61 | |||||||||||||
| 62 | 2 | $self->{'vars'} = []; | |||||||||||
| 63 | 2 | ▶ | if ($self->{'namelist'}) | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 64 | { | ||||||||||||
| 65 | 2 | my @names = split(/\s+/, $self->{'namelist'}); | |||||||||||
| 66 | 2 | foreach my $n (@names) | |||||||||||
| 67 | { | ||||||||||||
| 68 | 4 | push @{$self->{'vars'}}, $n; | |||||||||||
| 69 | } | ||||||||||||
| 70 | } | ||||||||||||
| 71 | |||||||||||||
| 72 | 2 | return 1; | |||||||||||
| 73 | |||||||||||||
| 74 | } | ||||||||||||
| 75 | |||||||||||||
| 76 | |||||||||||||
| 77 | 0 | ▶ | sub execute { | ||||||||||
|
Subroutine
execute: not called CC=7 SCAR=40.3
Pod
undocumented
| |||||||||||||
| 78 | 0 | my $self = shift; | |||||||||||
| 79 | 0 | my $handle = shift; | |||||||||||
| 80 | 0 | my $optParms = shift; | |||||||||||
| 81 | |||||||||||||
| 82 | |||||||||||||
| 83 | 0 | my $vxmlDoc = $self->getParentVXMLDocument(); | |||||||||||
| 84 | |||||||||||||
| 85 | 0 | my $next = $self->{'next'}; | |||||||||||
| 86 | 0 | ▶ | unless ($next) | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 87 | { | ||||||||||||
| 88 | 0 | warn "Submit::executed called but next not set?"; | |||||||||||
| 89 | |||||||||||||
| 90 | 0 | return $VoiceXML::Client::Flow::Directive{'ABORT'}; | |||||||||||
| 91 | } | ||||||||||||
| 92 | |||||||||||||
| 93 | |||||||||||||
| 94 | 0 | ▶ | if (scalar @{$self->{'vars'}}) | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 95 | { | ||||||||||||
| 96 | 0 | ▶ | $next .= '?' unless ($next =~ m/\?/); | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 97 | |||||||||||||
| 98 | 0 | foreach my $v (@{$self->{'vars'}}) | |||||||||||
| 99 | { | ||||||||||||
| 100 | 0 | my $val = $vxmlDoc->globalVar($v); | |||||||||||
| 101 | 0 | ▶ | if (defined $val) | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 102 | { | ||||||||||||
| 103 | 0 | $next .= "$v=$val&"; | |||||||||||
| 104 | } | ||||||||||||
| 105 | } | ||||||||||||
| 106 | } | ||||||||||||
| 107 | |||||||||||||
| 108 | 0 | ▶ | VoiceXML::Client::Util::log_msg("SUBMIT Setting next doc to '$next'") if ($VoiceXML::Client::Debug); | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 109 | |||||||||||||
| 110 | 0 | $vxmlDoc->nextDocument($next); | |||||||||||
| 111 | |||||||||||||
| 112 | 0 | return $VoiceXML::Client::Flow::Directive{'NEXTDOC'}; | |||||||||||
| 113 | } | ||||||||||||
| 114 | |||||||||||||
| 115 | |||||||||||||
| 116 | |||||||||||||
| 117 | |||||||||||||
| 118 | 3 | 1; | |||||||||||