blib/lib/SETI/Drake.pm

filter: Statementstmt 100% 23 / 23 Branchbran 100% 2 / 2 Conditioncond 33.3% 1 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 100% 5 / 5 Podpod 100% 2 / 2 totaltotal 89.1% 33 / 37 CC 5 SCAR 7.5
CC
5
Cov
93%
_init
3.0
new
2.0
N
2.0
CRAP 2.1
↑ Summary
1 # $Id: Drake.pm 868 2008-04-20 07:24:28Z gene $
2  
3 package SETI::Drake;
4 1 $VERSION = 0.0201;
5 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 5 ▶sub new {
Subroutine new: called CC=2 SCAR=7.1
Pod documented
9 5 my $class = shift;
10 5 ▶ my $proto = ref $class || $class;
Condition33%1/3
ref $class || $class
l!l&&r!l&&!r
050
MC/DC0%0/2
ref $class || $class
ref $class $class
Truth table33%1/3
A || B
A= ref $classB= $class
ABresult
1X1
011
000
11 5 my $self = {
12 defaults => {
13 R => 5,
14 fp => 0.5,
15 ne => 2,
16 fl => 1,
17 fi => 0.2,
18 fc => 1,
19 L => 10000,
20 },
21 @_
22 };
23 5 bless $self, $class;
24 5 $self->_init();
25 5 return $self;
26 }
27  
28 5 ▶sub _init {
Subroutine _init: called CC=3 SCAR=11.0
29 5 my $self = shift;
30 5 for( keys %{$self->{defaults}} ) {
31 # Make sure each equation term has a defined value.
32 $self->{$_} = $self->{defaults}{$_}
33 35 ▶ unless defined $self->{$_};
Branch: 1 branch
BranchTrueFalseTotal
unless defined $self->{$_} 7 28 35
34 }
35 }
36  
37 5 ▶sub N {
Subroutine N: called CC=2 SCAR=6.9
Pod documented
38 5 my $self = shift;
39 # Set N to the value of R.
40 5 my $N = $self->{R};
41 # Calculate the repeated product of every value of the object except R and the defaults.
42 5 $N *= $self->{$_} for grep { !/^R|defaults$/o } keys %$self;
43 5 return $N;
44 }
45  
46 1 1;
47  
48 __END__
↑ Summary