Com/Moon.pm

filter: Statementstmt 39.0% 16 / 41 Branchbran 0.0% 0 / 4 Conditioncond 0.0% 0 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 55.5% 5 / 9 Podpod 50.0% 2 / 4 totaltotal 36.5% 23 / 63 CC 4 SCAR 15.6
CC
4
Cov
33%
new
12.0
update
6.0
icon
2.0
CRAP 4.8
« Com/CurrentConditions.pm ↑ Summary Com/DateTime.pm »
1 package Weather::Com::Moon;
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.7 $ =~ /(\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->{ICON} = undef;
30 0 $self->{DESCRIPTION} = '';
31  
32 0 return $self;
33 } # end new()
34  
35 #------------------------------------------------------------------------
36 # update moon data
37 #------------------------------------------------------------------------
38 0 ▶sub update {
Subroutine update: not called CC=2 SCAR=17.9
Pod undocumented
39 0 my $self = shift;
40 0 my %moon;
41  
42 0 ▶ if ( ref( $_[0] ) eq "HASH" ) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $_[0] eq 'HASH') { } 0 0 0
43 0 %moon = %{ $_[0] };
44 } else {
45 0 %moon = @_;
46 }
47  
48 0 $self->{ICON} = $moon{icon};
49 0 $self->{DESCRIPTION} = lc( $moon{t} );
50  
51 0 return 1;
52 }
53  
54 #------------------------------------------------------------------------
55 # access moon data
56 #------------------------------------------------------------------------
57 0 ▶sub icon {
Subroutine icon: not called CC=1 SCAR=6.9
Pod documented
58 0 my $self = shift;
59 0 return $self->{ICON};
60 }
61  
62 0 ▶sub description {
Subroutine description: not called CC=1 SCAR=6.9
Pod documented
63 0 my $self = shift;
64 0 my $language = shift;
65  
66 return $self->get_language_handle($language)
67 0 ->maketext( lc( $self->{DESCRIPTION} ) );
68 }
69  
70 1 1;
71  
72 __END__
« Com/CurrentConditions.pm ↑ Summary Com/DateTime.pm »