blib/lib/Cisco/IPPhone.pm

filter: Statementstmt 4.2% 21 / 496 Branchbran 0.0% 0 / 90 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 7.8% 3 / 38 Podpod 94.2% 33 / 35 totaltotal 8.6% 57 / 659 CC 54 SCAR 28.5
CC
54
Cov
4%
Content
90.0
AddMenuItem
20.0
Content_Noheader
12.0
CRAP 17.3
↑ Summary
1 package Cisco::IPPhone;
2  
3 # Author: Mark Palmer markpalmer@us.ibm.com
4 # Date: 7/2002
5  
6 1 require 5.005_62;
7 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 1 require Exporter;
11  
12 1 our @ISA = qw(Exporter);
13  
14 # Items to export into callers namespace by default. Note: do not export
15 # names by default without a very good reason. Use EXPORT_OK instead.
16 # Do not simply export all your public functions/methods/constants.
17  
18 # This allows declaration use Cisco::IPPhone ':all';
19 # If you do not need this, moving things directly into @EXPORT or @EXPORT_OK
20 # will save memory.
21 1 our %EXPORT_TAGS = ( 'all' => [ qw(
22
23 ) ] );
24  
25 1 our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } );
26  
27 1 our @EXPORT = qw(
28
29 );
30 1 our $VERSION = '0.05';
31  
32  
33 # Preloaded methods go here.
34 ############# Code Here
35  
36 1 ▶use POSIX;
Subroutine BEGIN: called CC=1 SCAR=0.0
37  
38 1 $|=1; # Turn off buffered output
39  
40 # Hash Table containing URI options
41 # 7940 phones use Line1 and Line2
42 # 7960 phones use Line1 through Line6
43 # 7914 sidecar on 7960 phones use Line7 through Line20
44 # second 7914 sidecar phones use Line21 through Line34
45  
46 # URI Dial:1234 cuases the phone to dial 1234
47 # URI EditDial:1234 enables the user to edit the dial string 1234
48  
49 1 my %uriKeys = ( 0 => 'Key:KeyPad0', 1 => 'Key:KeyPad1', 2 => 'Key:KeyPad2',
50 3 => 'Key:KeyPad3', 4 => 'Key:KeyPad4', 5 => 'Key:KeyPad5', 6 => 'Key:KeyPad6',
51 7 => 'Key:KeyPad7', 8 => 'Key:KeyPad8', 9 => 'Key:KeyPad9', 10 => 'KeyPadStar',
52 11 => 'Key:KeyPadPound', 12 => 'Key:Soft1', 13 => 'Key:Soft2',
53 14 => 'Key:Soft3', 15 => 'Key:Soft4', 16 => 'Key:VolDwn', 17 => 'Key:VolUp',
54 18 => 'Key:Headset', 19 => 'Key:Speaker', 20 => 'Key:Mute', 21 => 'Key:Info',
55 22 => 'Key:Messages', 23 => 'Key:Services', 24 => 'Key:Directory',
56 25 => 'Key:Settings', 26 => 'Key:NavUp', 27 => 'Key:NavDwn',
57 28 => 'SoftKey:Update', 29 => 'SoftKey:Select', 30 => 'Key:SoftKey:Exit',
58 31 => 'Key:Line1', 32 => 'Key:Line2',
59 33 => 'Key:Line3', 34 => 'Key:Line4', 35 => 'Key:Line5', 36 => 'Key:Line6',
60 37 => 'Key:Line7', 38 => 'Key:Line8', 39 => 'Key:Line9', 40 => 'Key:Line10',
61 41 => 'Key:Line11', 42 => 'Key:Line12', 43 => 'Key:Line13', 44 => 'Key:Line14',
62 45 => 'Key:Line15', 46 => 'Key:Line16', 47 => 'Key:Line17', 48 => 'Key:Line18',
63 49 => 'Key:Line19', 50 => 'Key:Line20', 51 => 'Key:Line21', 52 => 'Key:Line22',
64 53 => 'Key:Line23', 54 => 'Key:Line24', 55 => 'Key:Line25', 56 => 'Key:Line26',
65 57 => 'Key:Line27', 58 => 'Key:Line28', 59 => 'Key:Line29', 60 => 'Key:Line30',
66 61 => 'Key:Line31', 62 => 'Key:Line32', 63 => 'Key:Line33', 64 => 'Key:Line34',
67 65 => 'Init:CallHistory', 66 => 'SoftKey:<<', 67 => 'SoftKey:Cancel' );
68  
69 # For use with InputItems
70 1 my %inputFlags = ( ASCII => 'A', Telephone => 'T', Numeric => 'N',
71 Equation => 'E', Uppercase => 'U', Lowercase => 'L', Password => 'P' );
72  
73 # Declaration of new object with data types defined and blessed for use
74 0 ▶sub new {
Subroutine new: not called CC=1 SCAR=6.9
Pod undocumented
75 0 my $package = shift;
76 0 my $this = { xmlobject => [] };
77 0 return bless($this, $package);
78 }
79  
80 0 ▶sub Print {
Subroutine Print: not called CC=1 SCAR=6.9
Pod documented
81 # Takes no input. Prints the xmlobject array datastructure to the phone
82 0 my $self = shift;
83 0 ${$self->{xmlobject}}[0] = "Content-Type: text/xml\n\n${$self->{xmlobject}}[0]";
84 0 print @{$self->{xmlobject}};
85 }
86  
87 0 ▶sub Content {
Subroutine Content: not called CC=9 SCAR=45.0
Pod documented
88 0 my $self = shift;
89 0 ▶ my $options = shift if (@_);
Branch: 1 branch
BranchTrueFalseTotal
if @_ 0 0 0
90 # Assume Content-Type is text/xml unless otherwise specified
91 0 my $header = '';
92  
93 0 ▶ if ($options->{Refresh}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($options->{"Refresh"}) 0 0 0
94 0 $header .= "refresh: $options->{Refresh};";
95 0 ▶ if ($options->{URL}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($options->{'URL'}) { } 0 0 0
96 0 $header .= " url=$options->{URL}\n";
97 } else {
98 0 $header .= "\n";
99 }
100 }
101 0 ▶ if ($options->{Location}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($options->{"Location"}) 0 0 0
102 0 $header .= "location: $options->{Location}\n";
103 }
104 0 ▶ if ($options->{Date}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($options->{"Date"}) 0 0 0
105 0 $header .= "date: $options->{Date}\n";
106 }
107 0 ▶ if ($options->{Expires}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($options->{"Expires"}) 0 0 0
108 0 $header .= "expires: $options->{Expires}\n";
109 }
110 0 ▶ if ($options->{Cookie}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($options->{"Cookie"}) 0 0 0
111 0 $header .= "Set-Cookie: $options->{Cookie}\n";
112 }
113 0 ▶ if ($options->{Type}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($options->{'Type'}) { } 0 0 0
114 0 $header .= "Content-Type: $options->{Type}\n\n";
115 } else {
116 0 $header .= "Content-Type: text/xml\n\n";
117 }
118  
119 0 ${$self->{xmlobject}}[0] = "${header}${$self->{xmlobject}}[0]";
120 0 return @{$self->{xmlobject}};
121 }
122  
123 0 ▶sub Content_Noheader {
Subroutine Content_Noheader: not called CC=3 SCAR=24.8
Pod documented
124 0 my $self = shift;
125 0 my $result = '';
126 0 my $line = '';
127 0 ▶ if (wantarray) { return @{$self->{xmlobject}} };
Branch: 1 branch
BranchTrueFalseTotal
if (wantarray) 0 0 0
128 0 foreach $line (@{$self->{xmlobject}}) {
129 0 $result .= $line;
130 }
131 0 return $result;
132 }
133  
134 0 ▶sub Text {
Subroutine Text: not called CC=2 SCAR=17.9
Pod documented
135 # Input: Title, Prompt, Text and optional softkeyitems or menuitems
136 0 my $self = shift;
137 0 ▶ my $options = shift if (@_);
Branch: 1 branch
BranchTrueFalseTotal
if @_ 0 0 0
138 0 push @{$self->{xmlobject}},"<CiscoIPPhoneText>\n";
139 0 push @{$self->{xmlobject}}, "<Title>$options->{Title}</Title>\n";
140 0 push @{$self->{xmlobject}}, "<Prompt>$options->{Prompt}</Prompt>\n";
141 0 push @{$self->{xmlobject}}, "<Text>$options->{Text}</Text>\n";
142 0 push @{$self->{xmlobject}}, "</CiscoIPPhoneText>\n";
143 0 return @{$self->{xmlobject}};
144 }
145  
146 0 ▶sub Menu {
Subroutine Menu: not called CC=2 SCAR=17.9
Pod documented
147 # Takes Title, Prompt and optional softkeyitems or menuitems
148 0 my $self = shift;
149 0 ▶ my $options = shift if (@_);
Branch: 1 branch
BranchTrueFalseTotal
if @_ 0 0 0
150 0 push @{$self->{xmlobject}},"<CiscoIPPhoneMenu>\n";
151 0 push @{$self->{xmlobject}},"<Title>$options->{Title}</Title>\n";
152 0 push @{$self->{xmlobject}},"<Prompt>$options->{Prompt}</Prompt>\n";
153 # Insert Menu Options using AddMenuItem
154 0 push @{$self->{xmlobject}},"</CiscoIPPhoneMenu>\n";
155 0 return @{$self->{xmlobject}};
156 }
157  
158 0 ▶sub MenuItem {
Subroutine MenuItem: not called CC=3 SCAR=24.8
Pod documented
159 # Input: Name and URL (or URI)
160 # A maximum of 99 MenuItem tags are allowed
161 0 my $self = shift;
162 0 ▶ my $options = shift if (@_);
Branch: 1 branch
BranchTrueFalseTotal
if @_ 0 0 0
163 0 push @{$self->{xmlobject}},"<MenuItem>\n";
164 0 ▶ push @{$self->{xmlobject}}, "<IconIndex>$options->{IconIndex}</IconIndex>\n" if $options->{IconIndex};
Branch: 1 branch
BranchTrueFalseTotal
if $options->{"IconIndex"} 0 0 0
165 0 push @{$self->{xmlobject}}, "<Name>$options->{Name}</Name>\n";
166 0 push @{$self->{xmlobject}}, "<URL>$options->{URL}</URL>\n";
167 0 push @{$self->{xmlobject}},"</MenuItem>\n";
168 0 return @{$self->{xmlobject}};
169 }
170  
171 0 ▶sub AddMenuItem {
Subroutine AddMenuItem: not called CC=4 SCAR=30.0
Pod documented
172 # Input: Name and URL (or URI)
173 # Adds the MenuItem to the Object that called this method
174 0 my $self = shift;
175 0 ▶ my $options = shift if (@_);
Branch: 1 branch
BranchTrueFalseTotal
if @_ 0 0 0
176  
177 # Pop off the Close Menu Tag
178 0 my $lastline = pop @{$self->{xmlobject}};
179  
180 0 push @{$self->{xmlobject}},"<MenuItem>\n";
181 0 ▶ push @{$self->{xmlobject}}, "<IconIndex>$options->{IconIndex}</IconIndex>\n" if $options->{IconIndex};
Branch: 1 branch
BranchTrueFalseTotal
if $options->{"IconIndex"} 0 0 0
182 0 push @{$self->{xmlobject}},"<Name>$options->{Name}</Name>\n";
183 0 push @{$self->{xmlobject}},"<URL>$options->{URL}</URL>\n";
184 0 push @{$self->{xmlobject}},"</MenuItem>\n";
185  
186 # Push the Close Menu Tag Back onto the Menu Object
187 0 push @{$self->{xmlobject}}, $lastline;
188 # Returns array if called in list context, or returns scalar
189 0 ▶ if (wantarray) { return @{$self->{xmlobject}} };
Branch: 1 branch
BranchTrueFalseTotal
if (wantarray) 0 0 0
190 0 return 1;
191 }
192  
193 0 ▶sub AddMenuItemObject {
Subroutine AddMenuItemObject: not called CC=3 SCAR=24.8
Pod documented
194 # Input: MenuItem Object
195 # Adds the MenuItem Object to the Object that called this method
196 0 my $line;
197 0 my $self = shift;
198 0 ▶ my $options = shift if (@_);
Branch: 1 branch
BranchTrueFalseTotal
if @_ 0 0 0
199  
200 # Pop off the Close Menu Tag
201 0 my $lastline = pop @{$self->{xmlobject}};
202  
203 # Push the MenuItems onto the menu
204 0 foreach $line (@{$options->{MenuItem}->{xmlobject}}) {
205 0 push @{$self->{xmlobject}},$line;
206 }
207 # Push the Close Menu Tag Back onto the Menu Object
208 0 push @{$self->{xmlobject}}, $lastline;
209 0 return @{$self->{xmlobject}};
210 }
211  
212 0 ▶sub Input {
Subroutine Input: not called CC=2 SCAR=17.9
Pod documented
213 # Input: Title, Prompt, URL
214 0 my $self = shift;
215 0 ▶ my $options = shift if (@_);
Branch: 1 branch
BranchTrueFalseTotal
if @_ 0 0 0
216 0 push @{$self->{xmlobject}},"<CiscoIPPhoneInput>\n";
217 0 push @{$self->{xmlobject}}, "<Title>$options->{Title}</Title>\n";
218 0 push @{$self->{xmlobject}}, "<Prompt>$options->{Prompt}</Prompt>\n";
219 0 push @{$self->{xmlobject}}, "<URL>$options->{URL}</URL>\n";
220 0 push @{$self->{xmlobject}}, "</CiscoIPPhoneInput>\n";
221 0 return @{$self->{xmlobject}};
222 }
223  
224 0 ▶sub InputItem {
Subroutine InputItem: not called CC=2 SCAR=17.9
Pod documented
225 # Input: DisplayName, QueryStringParam, DefaultValue, InputFlags
226 # Valid Input Tags: see inputFlags hash defined above
227  
228 0 my $self = shift;
229 0 ▶ my $options = shift if (@_);
Branch: 1 branch
BranchTrueFalseTotal
if @_ 0 0 0
230 0 push @{$self->{xmlobject}},"<InputItem>\n";
231 0 push @{$self->{xmlobject}}, "<DisplayName>$options->{DisplayName}</DisplayName>\n";
232 0 push @{$self->{xmlobject}}, "<QueryStringParam>$options->{QueryStringParam}</QueryStringParam>\n";
233 0 push @{$self->{xmlobject}}, "<DefaultValue>$options->{DefaultValue}</DefaultValue>\n";
234 0 push @{$self->{xmlobject}}, "<InputFlags>$options->{InputFlags}</InputFlags>\n";
235 0 push @{$self->{xmlobject}},"</InputItem>\n";
236 0 return @{$self->{xmlobject}};
237 }
238  
239 0 ▶sub AddInputItem {
Subroutine AddInputItem: not called CC=3 SCAR=24.8
Pod documented
240 # Input: DisplayName, QueryStringParam, DefaultValue, InputFlags
241 # Valid Input Tags: see inputFlags hash defined above
242 0 my $self = shift;
243 0 ▶ my $options = shift if (@_);
Branch: 1 branch
BranchTrueFalseTotal
if @_ 0 0 0
244  
245 # Pop off the Close Menu Tag
246 0 my $lastline = pop @{$self->{xmlobject}};
247  
248 0 push @{$self->{xmlobject}},"<InputItem>\n";
249 0 push @{$self->{xmlobject}}, "<DisplayName>$options->{DisplayName}</DisplayName>\n";
250 0 push @{$self->{xmlobject}}, "<QueryStringParam>$options->{QueryStringParam}</QueryStringParam>\n";
251 0 push @{$self->{xmlobject}}, "<DefaultValue>$options->{DefaultValue}</DefaultValue>\n";
252 0 push @{$self->{xmlobject}}, "<InputFlags>$options->{InputFlags}</InputFlags>\n";
253 0 push @{$self->{xmlobject}},"</InputItem>\n";
254  
255 # Push the Close Tag Back onto the Calling Object
256 0 push @{$self->{xmlobject}}, $lastline;
257 # Returns array if called in list context or returns scalar in scaler context
258 0 ▶ if (wantarray) { return @{$self->{xmlobject}} };
Branch: 1 branch
BranchTrueFalseTotal
if (wantarray) 0 0 0
259 0 return 1;
260 }
261  
262 0 ▶sub AddInputItemObject {
Subroutine AddInputItemObject: not called CC=3 SCAR=24.8
Pod documented
263 # Input: InputItem Object
264 # Adds the InputItem Object to the Object that called this method
265 0 my $line;
266 0 my $self = shift;
267 0 ▶ my $options = shift if (@_);
Branch: 1 branch
BranchTrueFalseTotal
if @_ 0 0 0
268  
269 # Pop off the Close Tag
270 0 my $lastline = pop @{$self->{xmlobject}};
271  
272 # Push the MenuItems onto the menu
273 0 foreach $line (@{$options->{InputItem}->{xmlobject}}) {
274 0 push @{$self->{xmlobject}},$line;
275 }
276 # Push the Close Tag Back onto the Calling Object
277 0 push @{$self->{xmlobject}}, $lastline;
278 0 return @{$self->{xmlobject}};
279 }
280  
281 0 ▶sub SoftKeyItem {
Subroutine SoftKeyItem: not called CC=2 SCAR=17.9
Pod documented
282 # Input: Name, URL (or URI), and Position
283 0 my $self = shift;
284 0 ▶ my $options = shift if (@_);
Branch: 1 branch
BranchTrueFalseTotal
if @_ 0 0 0
285 0 push @{$self->{xmlobject}},"<SoftKeyItem>\n";
286 0 push @{$self->{xmlobject}}, "<Name>$options->{Name}</Name>\n";
287 0 push @{$self->{xmlobject}}, "<URL>$options->{URL}</URL>\n";
288 0 push @{$self->{xmlobject}}, "<Position>$options->{Position}</Position>\n";
289 0 push @{$self->{xmlobject}},"</SoftKeyItem>\n";
290 0 return @{$self->{xmlobject}};
291 }
292  
293 0 ▶sub AddSoftKeyItem {
Subroutine AddSoftKeyItem: not called CC=2 SCAR=17.9
Pod documented
294 # Input: Name and URL (or URI), and Position
295 # Adds the SoftKeyItem Object to the Object that called this method
296 0 my $self = shift;
297 0 ▶ my $options = shift if (@_);
Branch: 1 branch
BranchTrueFalseTotal
if @_ 0 0 0
298  
299 # Pop off the Close Menu Tag
300 0 my $lastline = pop @{$self->{xmlobject}};
301  
302 0 push @{$self->{xmlobject}},"<SoftKeyItem>\n";
303 0 push @{$self->{xmlobject}},"<Name>$options->{Name}</Name>\n";
304 0 push @{$self->{xmlobject}},"<URL>$options->{URL}</URL>\n";
305 0 push @{$self->{xmlobject}},"<Position>$options->{Position}</Position>\n";
306 0 push @{$self->{xmlobject}},"</SoftKeyItem>\n";
307  
308 # Push the Close Menu Tag Back onto the Menu Object
309 0 push @{$self->{xmlobject}}, $lastline;
310 0 return @{$self->{xmlobject}};
311 }
312  
313 0 ▶sub AddSoftKeyItemObject {
Subroutine AddSoftKeyItemObject: not called CC=3 SCAR=24.8
Pod documented
314 # Input: SoftKeyItem Object
315 # Adds the SoftKeyItem Object to the Object that called this method
316 0 my $line;
317 0 my $self = shift;
318 0 ▶ my $options = shift if (@_);
Branch: 1 branch
BranchTrueFalseTotal
if @_ 0 0 0
319  
320 # Pop off the Close Tag
321 0 my $lastline = pop @{$self->{xmlobject}};
322  
323 # Push the SoftKeyItems onto the Calling Object
324 0 foreach $line (@{$options->{SoftKeyItem}->{xmlobject}}) {
325 0 push @{$self->{xmlobject}},$line;
326 }
327 # Push the Close Tag Back onto the Calling Object
328 0 push @{$self->{xmlobject}}, $lastline;
329 0 return @{$self->{xmlobject}};
330 }
331  
332 0 ▶sub Directory {
Subroutine Directory: not called CC=2 SCAR=17.9
Pod documented
333 # Input: Title and Prompt
334 0 my $self = shift;
335 0 ▶ my $options = shift if (@_);
Branch: 1 branch
BranchTrueFalseTotal
if @_ 0 0 0
336 0 push @{$self->{xmlobject}},"<CiscoIPPhoneDirectory>\n";
337 0 push @{$self->{xmlobject}},"<Title>$options->{Title}</Title>\n";
338 0 push @{$self->{xmlobject}},"<Prompt>$options->{Prompt}</Prompt>\n";
339 # Insert Directory Entries using AddDirectoryEntry
340 0 push @{$self->{xmlobject}},"</CiscoIPPhoneDirectory>\n";
341 }
342  
343 0 ▶sub DirectoryEntry {
Subroutine DirectoryEntry: not called CC=2 SCAR=17.9
Pod documented
344 # Input: Name and Telephone
345 0 my $self = shift;
346 0 ▶ my $options = shift if (@_);
Branch: 1 branch
BranchTrueFalseTotal
if @_ 0 0 0
347 0 push @{$self->{xmlobject}},"<DirectoryEntry>\n";
348 0 push @{$self->{xmlobject}}, "<Name>$options->{Name}</Name>\n";
349 0 push @{$self->{xmlobject}}, "<Telephone>$options->{Telephone}</Telephone>\n";
350 0 push @{$self->{xmlobject}},"</DirectoryEntry>\n";
351 0 return @{$self->{xmlobject}};
352 }
353  
354 0 ▶sub AddDirectoryEntry {
Subroutine AddDirectoryEntry: not called CC=3 SCAR=24.8
Pod documented
355 # Input: Name and URL (or URI)
356 # Adds the DirectoryEntry to the Object that called this method
357 0 my $self = shift;
358 0 ▶ my $options = shift if (@_);
Branch: 1 branch
BranchTrueFalseTotal
if @_ 0 0 0
359  
360 # Pop off the Close Tag
361 0 my $lastline = pop @{$self->{xmlobject}};
362  
363 0 push @{$self->{xmlobject}},"<DirectoryEntry>\n";
364 0 push @{$self->{xmlobject}},"<Name>$options->{Name}</Name>\n";
365 0 push @{$self->{xmlobject}},"<Telephone>$options->{Telephone}</Telephone>\n";
366 0 push @{$self->{xmlobject}},"</DirectoryEntry>\n";
367  
368 # Push the Close Tag Back onto the Calling Object
369 0 push @{$self->{xmlobject}}, $lastline;
370  
371 # Returns array if called in list context, or returns scalar
372 0 ▶ if (wantarray) { return @{$self->{xmlobject}} };
Branch: 1 branch
BranchTrueFalseTotal
if (wantarray) 0 0 0
373 0 return 1;
374 }
375  
376 0 ▶sub AddDirectoryEntryObject {
Subroutine AddDirectoryEntryObject: not called CC=3 SCAR=24.8
Pod documented
377 # Input: DirectoryEntry Object
378 # Adds the Directory Entry Object to the Object that called this method
379 0 my $line;
380 0 my $self = shift;
381 0 ▶ my $options = shift if (@_);
Branch: 1 branch
BranchTrueFalseTotal
if @_ 0 0 0
382  
383 # Pop off the Close Tag
384 0 my $lastline = pop @{$self->{xmlobject}};
385  
386 # Push the Directory Entries onto the Calling Object
387 0 foreach $line (@{$options->{DirectoryEntry}->{xmlobject}}) {
388 0 push @{$self->{xmlobject}},$line;
389 }
390 # Push the Close Tag Back onto the Calling Object
391 0 push @{$self->{xmlobject}}, $lastline;
392 0 return @{$self->{xmlobject}};
393 }
394  
395 0 ▶sub Image {
Subroutine Image: not called CC=2 SCAR=17.9
Pod documented
396 # Input: Title,Prompt,LocationX,LocationY,Width,Height,Depth,Data
397 0 my $self = shift;
398 0 ▶ my $options = shift if (@_);
Branch: 1 branch
BranchTrueFalseTotal
if @_ 0 0 0
399 0 push @{$self->{xmlobject}},"<CiscoIPPhoneImage>\n";
400 0 push @{$self->{xmlobject}},"<Title>$options->{Title}</Title>\n";
401 0 push @{$self->{xmlobject}},"<Prompt>$options->{Prompt}</Prompt>\n";
402 0 push @{$self->{xmlobject}},"<LocationX>$options->{LocationX}</LocationX>\n";
403 0 push @{$self->{xmlobject}},"<LocationY>$options->{LocationY}</LocationY>\n";
404 0 push @{$self->{xmlobject}},"<Width>$options->{Width}</Width>\n";
405 0 push @{$self->{xmlobject}},"<Height>$options->{Height}</Height>\n";
406 0 push @{$self->{xmlobject}},"<Depth>$options->{Depth}</Depth>\n";
407 0 push @{$self->{xmlobject}},"<Data>$options->{Data}</Data>\n";
408 0 push @{$self->{xmlobject}},"</CiscoIPPhoneImage>\n";
409 0 return @{$self->{xmlobject}};
410 }
411  
412 0 ▶sub GraphicMenu {
Subroutine GraphicMenu: not called CC=2 SCAR=17.9
Pod documented
413 # Input: Title,Prompt,LocationX,LocationY,Width,Height,Depth,Data
414 0 my $self = shift;
415 0 ▶ my $options = shift if (@_);
Branch: 1 branch
BranchTrueFalseTotal
if @_ 0 0 0
416 0 push @{$self->{xmlobject}},"<CiscoIPPhoneGraphicMenu>\n";
417 0 push @{$self->{xmlobject}},"<Title>$options->{Title}</Title>\n";
418 0 push @{$self->{xmlobject}},"<Prompt>$options->{Prompt}</Prompt>\n";
419 0 push @{$self->{xmlobject}},"<LocationX>$options->{LocationX}</LocationX>\n";
420 0 push @{$self->{xmlobject}},"<LocationY>$options->{LocationY}</LocationY>\n";
421 0 push @{$self->{xmlobject}},"<Width>$options->{Width}</Width>\n";
422 0 push @{$self->{xmlobject}},"<Height>$options->{Height}</Height>\n";
423 0 push @{$self->{xmlobject}},"<Depth>$options->{Depth}</Depth>\n";
424 0 push @{$self->{xmlobject}},"<Data>$options->{Data}</Data>\n";
425 0 push @{$self->{xmlobject}},"</CiscoIPPhoneGraphicMenu>\n";
426 0 return @{$self->{xmlobject}};
427 }
428  
429 0 ▶sub IconMenu {
Subroutine IconMenu: not called CC=2 SCAR=17.9
Pod documented
430 # Takes Title, Prompt and optional softkeyitems or menuitems
431 0 my $self = shift;
432 0 ▶ my $options = shift if (@_);
Branch: 1 branch
BranchTrueFalseTotal
if @_ 0 0 0
433 0 push @{$self->{xmlobject}},"<CiscoIPPhoneIconMenu>\n";
434 0 push @{$self->{xmlobject}},"<Title>$options->{Title}</Title>\n";
435 0 push @{$self->{xmlobject}},"<Prompt>$options->{Prompt}</Prompt>\n";
436 # Insert Menu Options using AddMenuItem
437 # Insert SoftKey Options using AddSoftKeyItem
438 # Insert Icon Options using AddIconItem
439 0 push @{$self->{xmlobject}},"</CiscoIPPhoneIconMenu>\n";
440 0 return @{$self->{xmlobject}};
441 }
442  
443 0 ▶sub IconItem {
Subroutine IconItem: not called CC=2 SCAR=17.9
Pod documented
444 # Input: Index, Height, Width, Depth, Data
445 # Build IconItem Object
446 0 my $self = shift;
447 0 ▶ my $options = shift if (@_);
Branch: 1 branch
BranchTrueFalseTotal
if @_ 0 0 0
448  
449 0 push @{$self->{xmlobject}},"<IconItem>\n";
450 0 push @{$self->{xmlobject}},"<Index>$options->{Index}</Index>\n";
451 0 push @{$self->{xmlobject}},"<Height>$options->{Height}</Height>\n";
452 0 push @{$self->{xmlobject}},"<Width>$options->{Width}</Width>\n";
453 0 push @{$self->{xmlobject}},"<Depth>$options->{Depth}</Depth>\n";
454 0 push @{$self->{xmlobject}},"<Data>$options->{Data}</Data>\n";
455 0 push @{$self->{xmlobject}},"</IconItem>\n";
456  
457 0 return @{$self->{xmlobject}};
458 }
459  
460 0 ▶sub AddIconItem {
Subroutine AddIconItem: not called CC=2 SCAR=17.9
Pod documented
461 # Input: Index, Height, Width, Depth, Data
462 # Adds the IconItem Object to the IconMenu Object that called this method
463 0 my $self = shift;
464 0 ▶ my $options = shift if (@_);
Branch: 1 branch
BranchTrueFalseTotal
if @_ 0 0 0
465  
466 # Pop off the Close IconMenu Tag
467 0 my $lastline = pop @{$self->{xmlobject}};
468  
469 0 push @{$self->{xmlobject}},"<IconItem>\n";
470 0 push @{$self->{xmlobject}},"<Index>$options->{Index}</Index>\n";
471 0 push @{$self->{xmlobject}},"<Height>$options->{Height}</Height>\n";
472 0 push @{$self->{xmlobject}},"<Width>$options->{Width}</Width>\n";
473 0 push @{$self->{xmlobject}},"<Depth>$options->{Depth}</Depth>\n";
474 0 push @{$self->{xmlobject}},"<Data>$options->{Data}</Data>\n";
475 0 push @{$self->{xmlobject}},"</IconItem>\n";
476  
477 # Push the Close IconMenu Tag Back onto the Menu Object
478 0 push @{$self->{xmlobject}}, $lastline;
479 0 return @{$self->{xmlobject}};
480 }
481  
482 0 ▶sub AddIconItemObject {
Subroutine AddIconItemObject: not called CC=3 SCAR=24.8
Pod documented
483 # Input: IconItem Object
484 # Adds the IconItem Object to the Object that called this method
485 0 my $line;
486 0 my $self = shift;
487 0 ▶ my $options = shift if (@_);
Branch: 1 branch
BranchTrueFalseTotal
if @_ 0 0 0
488  
489 # Pop off the Close Tag
490 0 my $lastline = pop @{$self->{xmlobject}};
491  
492 # Push the Icon Items onto the Calling Object
493 0 foreach $line (@{$options->{IconItem}->{xmlobject}}) {
494 0 push @{$self->{xmlobject}},$line;
495 }
496 # Push the Close Tag Back onto the Calling Object
497 0 push @{$self->{xmlobject}}, $lastline;
498 0 return @{$self->{xmlobject}};
499 }
500  
501 0 ▶sub Execute {
Subroutine Execute: not called CC=1 SCAR=6.9
Pod documented
502 # Input: None
503 0 my $self = shift;
504 0 push @{$self->{xmlobject}},"<CiscoIPPhoneExecute>\n";
505 # Insert Execute Items using AddExecuteItem
506 0 push @{$self->{xmlobject}},"</CiscoIPPhoneExecute>\n";
507 0 return @{$self->{xmlobject}};
508 }
509  
510 0 ▶sub AddExecuteItem {
Subroutine AddExecuteItem: not called CC=3 SCAR=24.8
Pod documented
511 # Input: URL to be executed (can have up to 3 items in one execute object)
512 0 my $self = shift;
513 0 ▶ my $options = shift if (@_);
Branch: 1 branch
BranchTrueFalseTotal
if @_ 0 0 0
514  
515 # Pop off the Close Tag
516 0 my $lastline = pop @{$self->{xmlobject}};
517  
518 0 push @{$self->{xmlobject}},"<ExecuteItem URL=\"$options->{ExecuteItem}\"/>\n";
519  
520 # Push the Close Tag Back onto the Calling Object
521 0 push @{$self->{xmlobject}}, $lastline;
522  
523 # Returns array if called in list context, or returns scalar
524 0 ▶ if (wantarray) { return @{$self->{xmlobject}} };
Branch: 1 branch
BranchTrueFalseTotal
if (wantarray) 0 0 0
525 0 return 1;
526 }
527  
528 0 ▶sub AddExecuteItemObject {
Subroutine AddExecuteItemObject: not called CC=3 SCAR=24.8
Pod documented
529 # Input: ExecuteItem Object
530 # Adds the Execute Item Object to the Object that called this method
531 0 my $line;
532 0 my $self = shift;
533 0 ▶ my $options = shift if (@_);
Branch: 1 branch
BranchTrueFalseTotal
if @_ 0 0 0
534  
535 # Pop off the Close Tag
536 0 my $lastline = pop @{$self->{xmlobject}};
537  
538 # Push the Directory Entries onto the Calling Object
539 0 foreach $line (@{$options->{ExecuteItem}->{xmlobject}}) {
540 0 push @{$self->{xmlobject}},$line;
541 }
542 # Push the Close Tag Back onto the Calling Object
543 0 push @{$self->{xmlobject}}, $lastline;
544 0 return @{$self->{xmlobject}};
545 }
546  
547 0 ▶sub Response {
Subroutine Response: not called CC=1 SCAR=6.9
Pod documented
548 # Input: None
549 0 my $self = shift;
550 0 push @{$self->{xmlobject}},"<CiscoIPPhoneResponse>\n";
551 # Insert Response Items using AddResponseItem
552 0 push @{$self->{xmlobject}},"</CiscoIPPhoneResponse>\n";
553 0 return @{$self->{xmlobject}};
554 }
555  
556 0 ▶sub ResponseItem {
Subroutine ResponseItem: not called CC=3 SCAR=24.8
Pod documented
557 # Input: URL to be executed (can have up to 3 items in one execute object)
558 0 my $self = shift;
559 0 ▶ my $options = shift if (@_);
Branch: 1 branch
BranchTrueFalseTotal
if @_ 0 0 0
560 0 push @{$self->{xmlobject}},"<ResponseItem Status=\"$options->{Status}\" Data=\"$options->{Data}\" URL=\"$options->{URL}\"/>\n";
561 # Returns array if called in list context, or returns scalar
562 0 ▶ if (wantarray) { return @{$self->{xmlobject}} };
Branch: 1 branch
BranchTrueFalseTotal
if (wantarray) 0 0 0
563 0 return 1;
564 }
565  
566 0 ▶sub AddResponseItem {
Subroutine AddResponseItem: not called CC=3 SCAR=24.8
Pod documented
567 # Input: URL to be executed (can have up to 3 items in one execute object)
568 0 my $self = shift;
569 0 ▶ my $options = shift if (@_);
Branch: 1 branch
BranchTrueFalseTotal
if @_ 0 0 0
570  
571 # Pop off the Close Tag
572 0 my $lastline = pop @{$self->{xmlobject}};
573  
574 0 push @{$self->{xmlobject}},"<ResponseItem Status=\"$options->{Status}\" Data=\"$options->{Data}\" URL=\"$options->{URL}\"/>\n";
575  
576 # Push the Close Tag Back onto the Calling Object
577 0 push @{$self->{xmlobject}}, $lastline;
578  
579 # Returns array if called in list context, or returns scalar
580 0 ▶ if (wantarray) { return @{$self->{xmlobject}} };
Branch: 1 branch
BranchTrueFalseTotal
if (wantarray) 0 0 0
581 0 return 1;
582 }
583  
584 0 ▶sub AddResponseItemObject {
Subroutine AddResponseItemObject: not called CC=3 SCAR=24.8
Pod documented
585 # Input: ResponseItem Object
586 # Adds the Response Item Object to the Object that called this method
587 0 my $line;
588 0 my $self = shift;
589 0 ▶ my $options = shift if (@_);
Branch: 1 branch
BranchTrueFalseTotal
if @_ 0 0 0
590  
591 # Pop off the Close Tag
592 0 my $lastline = pop @{$self->{xmlobject}};
593  
594 # Push the Directory Entries onto the Calling Object
595 0 foreach $line (@{$options->{ResponseItem}->{xmlobject}}) {
596 0 push @{$self->{xmlobject}},$line;
597 }
598 # Push the Close Tag Back onto the Calling Object
599 0 push @{$self->{xmlobject}}, $lastline;
600 0 return @{$self->{xmlobject}};
601 }
602  
603 # Possible error codes:
604 # Error 1 = Error parsing CiscoIPPhoneExecute object
605 # Error 2 = Error framing CiscoIPPhoneResponse object
606 # Error 3 = Internal file error
607 # Error 4 = Authentication error
608  
609 0 ▶sub Error {
Subroutine Error: not called CC=2 SCAR=17.9
Pod documented
610 # USE &quot; for double quotes on phone
611 # Input: Number representing error number
612 0 my $self = shift;
613 0 ▶ my $options = shift if (@_);
Branch: 1 branch
BranchTrueFalseTotal
if @_ 0 0 0
614 0 push @{$self->{xmlobject}},"<CiscoIPPhoneError Number=\"$options->{Number}\"/>\n";
615 0 return @{$self->{xmlobject}};
616 }
617  
618 0 ▶sub Date {
Subroutine Date: not called CC=1 SCAR=6.9
Pod undocumented
619 0 my ($sec, $min, $hour, $mday, $mon, $year);
620 0 ($sec,$min,$hour,$mday,$mon,$year) = localtime(time);
621 0 my $date = POSIX::strftime("%Y%m%e",$sec, $min, $hour, $mday, $mon, $year);
622 0 $date =~ s/\s/0/;
623 0 return $date;
624 }
625  
626 ############# End Code
627  
628 1 1;
629 __END__
↑ Summary