File Coverage

blib/lib/VoiceXML/Client/Item/Var.pm
Criterion Covered Total %
statement 31 31 100.0
branch 3 4 75.0
condition 2 3 66.6
subroutine 7 7 100.0
pod 1 2 50.0
total 44 47 93.6


line stmt bran cond sub pod time code
1              
2             package VoiceXML::Client::Item::Var;
3              
4              
5 3     3   16 use base qw (VoiceXML::Client::Item);
  3         8  
  3         222  
6 3     3   17 use VoiceXML::Client::Util;
  3         6  
  3         57  
7 3     3   15 use VoiceXML::Client::Item::Util;
  3         6  
  3         81  
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 .
40              
41              
42             =cut
43              
44              
45              
46 3     3   16 use strict;
  3         5  
  3         172  
47              
48 3         799 use vars qw{
49             $VERSION
50 3     3   17 };
  3         5  
51              
52             $VERSION = $VoiceXML::Client::Item::VERSION;
53              
54              
55              
56              
57             sub init {
58 6     6 1 9 my $self = shift;
59            
60 6         21 my $name = $self->{'XMLElement'}->attribute('name');
61 6         88 my $val = $self->{'XMLElement'}->attribute('expr');
62              
63 6 50       83 return undef unless (defined $name);
64            
65 6         28 my $vxmlDoc = $self->getParentVXMLDocument()->registerVariable($name);
66            
67            
68 6         17 $self->{'name'} = $name;
69 6         11 $self->{'expr'} = $val;
70            
71 6         15 return 1;
72            
73            
74             }
75              
76             sub execute {
77 6     6 0 9 my $self = shift;
78 6         9 my $handle = shift;
79 6         7 my $optParams = shift;
80            
81 6         21 my $vxmlDoc = $self->getParentVXMLDocument();
82 6         32 VoiceXML::Client::Item::Util->declareVariable($self, $self->{'name'}, $vxmlDoc);
83 6 100 66     41 if (defined $self->{'expr'} && length($self->{'expr'}))
84             {
85 2         11 VoiceXML::Client::Item::Util->assignVariable($self, $self->{'name'}, $self->{'expr'}, $vxmlDoc);
86             }
87            
88            
89 6         29 return $self->executeChildren($handle, $optParams);
90             }
91            
92              
93              
94              
95             1;