Local/hpux.pm

filter: Statementstmt 67.5% 25 / 37 Branchbran 31.2% 5 / 16 Conditioncond 33.3% 1 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 100% 9 / 9 Podpod 100% 1 / 1 totaltotal 60.2% 41 / 68 CC 10 SCAR 22.1
CC
10
Cov
55%
_FromEtcTIMEZONE
23.3
BEGIN
3.3
_FromJava
2.4
CRAP 9.1
« HPUX.pm ↑ Summary HPUX/Map.pm »
1 package DateTime::TimeZone::Local::hpux;
2  
3 3 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 3 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 # Debugging flags, used in the testsuite
7 3 ▶BEGIN {
Subroutine BEGIN: called CC=3 SCAR=12.0
8 3 ▶ defined &SKIP_ETC_TIMEZONE or *SKIP_ETC_TIMEZONE = sub () { 0 };
Branch: 1 branch
BranchTrueFalseTotal
defined &DateTime::TimeZone::Local::hpux::SKIP_ETC_TIMEZONE or *SKIP_ETC_TIMEZONE = sub () { 0 } 0 3 3
9 3 ▶ defined &SKIP_JAVA or *SKIP_JAVA = sub () { 0 };
Branch: 1 branch
BranchTrueFalseTotal
defined &DateTime::TimeZone::Local::hpux::SKIP_JAVA or *SKIP_JAVA = sub () { 0 } 0 3 3
10 }
11  
12  
13  
14 3 ▶use base 'DateTime::TimeZone::Local';
Subroutine BEGIN: called CC=1 SCAR=0.0
15 3 ▶use DateTime::TimeZone::HPUX;
Subroutine BEGIN: called CC=1 SCAR=0.0
16  
17 sub Methods
18 1 ▶{
Subroutine Methods: called CC=1 SCAR=0.0
Pod documented
19 1 qw( _FromEnv _FromEtcTIMEZONE _FromJava )
20 }
21  
22 # TODO Build the full timezone database from /usr/lib/tztab
23 sub _FromEnv
24 1 ▶{
Subroutine _FromEnv: called CC=2 SCAR=7.2
25 1 ▶ return unless exists $ENV{TZ};
Branch: 1 branch
BranchTrueFalseTotal
unless exists $ENV{"TZ"} 0 1 1
26 DateTime::TimeZone::HPUX::_hpux_to_olson($ENV{TZ})
27 1 }
28  
29 sub _FromEtcTIMEZONE
30 1 ▶{
Subroutine _FromEtcTIMEZONE: called CC=6 SCAR=31.5
31 1 return if SKIP_ETC_TIMEZONE;
32  
33 1 my $tz_file = '/etc/TIMEZONE';
34  
35 1 ▶ return unless -f $tz_file && -r _;
Branch: 1 branch
BranchTrueFalseTotal
unless -f $tz_file and -r _ 1 0 1
Condition33%1/3
-f $tz_file and -r _
!ll&&!rl&&r
100
MC/DC0%0/2
-f $tz_file and -r _
-f $tz_file -r _
Truth table33%1/3
A and B
A= -f $tz_fileB= -r _
ABresult
0X0
100
111
36  
37 0 local *TZ;
38 0 ▶ open TZ, "<$tz_file"
Branch: 1 branch
BranchTrueFalseTotal
open TZ, "<$tz_file" or die "Cannot read ${tz_file}: $!" 0 0 0
39 or die "Cannot read $tz_file: $!";
40  
41 0 my $name;
42 0 ▶ while ( defined( $name = <TZ> ) )
Branch: 1 branch
BranchTrueFalseTotal
if (defined($name = readline TZ)) 0 0 0
43 {
44 0 ▶ if ( $name =~ /\A\s*TZ\s*=\s*(\S+)/ )
Branch: 1 branch
BranchTrueFalseTotal
if ($name =~ /\A\s*TZ\s*=\s*(\S+)/) 0 0 0
45 {
46 0 $name = $1;
47 0 last;
48 }
49 }
50 0 close TZ;
51  
52 0 DateTime::TimeZone::HPUX::_hpux_to_olson($name)
53 }
54  
55 # Retrieve the default timezone using Java (java.util.TimeZone.getDefault())
56 sub _FromJava
57 1 ▶{
Subroutine _FromJava: called CC=2 SCAR=8.5
58 1 return if SKIP_JAVA;
59 1 warn('Retrieving default timezone using Java (SLOOOOOW)... You should instead set $ENV{TZ}');
60 1 my $tz_name = DateTime::TimeZone::HPUX::_olson_from_java();
61 1 ▶ return unless defined $tz_name;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $tz_name 1 0 1
62  
63 # Build a DT::TZ object from the name returned by Java
64 0 local $@;
65 0 return eval { DateTime::TimeZone->new(name => $tz_name) };
66 }
67  
68  
69 3 1;
70 __END__
« HPUX.pm ↑ Summary HPUX/Map.pm »