Client/Util.pm

filter: Statementstmt 61.1% 11 / 18 Branchbran 0.0% 0 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 75.0% 3 / 4 Podpod 0.0% 0 / 2 totaltotal 50.0% 14 / 28 CC 3 SCAR 18.7
CC
3
Cov
50%
error
12.0
BEGIN
1.0
BEGIN
1.0
CRAP 6.5
« Client/Item/Goto.pm ↑ Summary Client/Item/Clear.pm »
1 package VoiceXML::Client::Util;
2  
3 3 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5  
6 =head1 COPYRIGHT AND LICENSE
7  
8
9 Copyright (C) 2007,2008 by Pat Deegan.
10 All rights reserved
11 http://voicexml.psychogenic.com
12  
13 This library is released under the terms of the GNU GPL version 3, making it available only for
14 free programs ("free" here being used in the sense of the GPL, see http://www.gnu.org for more details).
15 Anyone wishing to use this library within a proprietary or otherwise non-GPLed program MUST contact psychogenic.com to
16 acquire a distinct license for their application. This approach encourages the use of free software
17 while allowing for proprietary solutions that support further development.
18  
19  
20 This file is part of VoiceXML::Client.
21  
22
23
24 VoiceXML::Client is free software: you can redistribute it and/or modify
25 it under the terms of the GNU General Public License as published by
26 the Free Software Foundation, either version 3 of the License, or
27 (at your option) any later version.
28  
29 VoiceXML::Client is distributed in the hope that it will be useful,
30 but WITHOUT ANY WARRANTY; without even the implied warranty of
31 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
32 GNU General Public License for more details.
33  
34 You should have received a copy of the GNU General Public License
35 along with VoiceXML::Client. If not, see <http://www.gnu.org/licenses/>.
36  
37  
38 =cut
39  
40 3 ▶use vars qw{
Subroutine BEGIN: called CC=1 SCAR=0.0
41 $Die_on_error
42 3 };
43  
44 3 $Die_on_error = 0;
45  
46 0 ▶sub error {
Subroutine error: not called CC=3 SCAR=24.8
Pod undocumented
47 0 my $error = shift;
48 0 my $exit = shift; # optional
49
50 0 ▶ $exit = 255
Branch: 1 branch
BranchTrueFalseTotal
unless defined $exit 0 0 0
51 unless (defined $exit);
52
53 0 my $date = localtime(time);
54
55 0 print STDERR "$0 $date [$$] Fatal Error: $error\n";
56
57 0 ▶ die $error
Branch: 1 branch
BranchTrueFalseTotal
if $VoiceXML::Client::Util::Die_on_error 0 0 0
58 if ($Die_on_error);
59
60 0 exit($exit);
61
62 }
63  
64  
65  
66 6 ▶sub log_msg {
Subroutine log_msg: called CC=1 SCAR=0.0
Pod undocumented
67 6 my @msg = @_;
68
69 6 print STDERR "$0 [$$]: " , @msg, "\n";
70
71 6 return;
72 }
73
74 3 1;
« Client/Item/Goto.pm ↑ Summary Client/Item/Clear.pm »