Com/UVIndex.pm

filter: Statementstmt 36.3% 16 / 44 Branchbran 0.0% 0 / 6 Conditioncond 0.0% 0 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 55.5% 5 / 9 Podpod 50.0% 2 / 4 totaltotal 33.8% 23 / 68 CC 5 SCAR 18.3
CC
5
Cov
30%
new
12.0
update
12.0
index
2.0
CRAP 6.2
« Com/DayPart.pm ↑ Summary Com/CurrentConditions.pm »
1 package Weather::Com::UVIndex;
2  
3 1 ▶use 5.006;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 1 ▶use Weather::Com::L10N;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 1 ▶use base 'Weather::Com::Object';
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 1 our $VERSION = sprintf "%d.%03d", q$Revision: 1.9 $ =~ /(\d+)/g;
10  
11 #------------------------------------------------------------------------
12 # Constructor
13 #------------------------------------------------------------------------
14 0 ▶sub new {
Subroutine new: not called CC=3 SCAR=24.8
Pod undocumented
15 0 my $proto = shift;
16 0 ▶ my $class = ref($proto) || $proto;
Condition0%0/3
ref $proto || $proto
l!l&&r!l&&!r
000
MC/DC0%0/2
ref $proto || $proto
ref $proto $proto
Truth table0%0/3
A || B
A= ref $protoB= $proto
ABresult
1X1
011
000
17 0 my %parameters;
18  
19 # parameters provided by new method
20 0 ▶ if ( ref( $_[0] ) eq "HASH" ) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $_[0] eq 'HASH') { } 0 0 0
21 0 %parameters = %{ $_[0] };
22 } else {
23 0 %parameters = @_;
24 }
25  
26 0 my $self = $class->SUPER::new( \%parameters );
27  
28 # getting first weather information
29 0 $self->{INDEX} = -1;
30 0 $self->{DESCRIPTION} = 'unknown';
31  
32 0 return $self;
33 } # end new()
34  
35 #------------------------------------------------------------------------
36 # update wind data
37 #------------------------------------------------------------------------
38 0 ▶sub update {
Subroutine update: not called CC=3 SCAR=24.8
Pod undocumented
39 0 my $self = shift;
40 0 my %uv;
41  
42 0 ▶ if ( ref( $_[0] ) eq "HASH" ) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $_[0] eq 'HASH') { } 0 0 0
43 0 %uv = %{ $_[0] };
44 } else {
45 0 %uv = @_;
46 }
47  
48 0 ▶ unless ( $uv{i} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($uv{'i'}) { } 0 0 0
49 0 $self->{INDEX} = -1;
50 0 $self->{DESCRIPTION} = "unknown";
51 } else {
52 0 $self->{INDEX} = $uv{i};
53 0 $self->{DESCRIPTION} = lc( $uv{t} );
54 }
55  
56 0 return 1;
57 }
58  
59 #------------------------------------------------------------------------
60 # accessor methods
61 #------------------------------------------------------------------------
62 0 ▶sub index {
Subroutine index: not called CC=1 SCAR=6.9
Pod documented
63 0 my $self = shift;
64 0 return $self->{INDEX};
65 }
66  
67 0 ▶sub description {
Subroutine description: not called CC=1 SCAR=6.9
Pod documented
68 0 my $self = shift;
69 0 my $language = shift;
70  
71 return $self->get_language_handle($language)
72 0 ->maketext( $self->{DESCRIPTION} );
73 }
74  
75 1 1;
76  
77 __END__
« Com/DayPart.pm ↑ Summary Com/CurrentConditions.pm »