Quantity/Abstract/Compound.pm

filter: Statementstmt 95.6% 22 / 23 Branchbran 50.0% 1 / 2 Conditioncond 33.3% 1 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 85.7% 6 / 7 Podpod 0.0% 0 / 3 totaltotal 75.0% 30 / 40 CC 3 SCAR 6.2
CC
3
Cov
86%
new_instance
3.2
component_classes
2.0
BEGIN
1.0
CRAP 1.9
« Quantity/Abstract/Base.pm ↑ Summary Quantity/Number/Bytes.pm »
1 ### Change History
2 # 1999-02-21 Created. -Simon
3  
4 package Data::Quantity::Abstract::Compound;
5  
6 1 require 5;
7 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 1 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 1 ▶use vars qw( $VERSION );
Subroutine BEGIN: called CC=1 SCAR=0.0
11 1 $VERSION = 0.001;
12  
13 1 ▶use Data::Quantity::Abstract::Base '-isasubclass';
Subroutine BEGIN: called CC=1 SCAR=0.0
14  
15 # $clone_q = $quantity->new_instance();
16 # $empty_q = Data::Quantity::Abstract::Compound->new_instance();
17 2 ▶sub new_instance {
Subroutine new_instance: called CC=3 SCAR=11.8
Pod undocumented
18 2 my $referent = shift;
19 2 ▶ my $class = ref($referent) || $referent;
Condition33%1/3
ref $referent || $referent
l!l&&r!l&&!r
020
MC/DC0%0/2
ref $referent || $referent
ref $referent $referent
Truth table33%1/3
A || B
A= ref $referentB= $referent
ABresult
1X1
011
000
20 my $month_q = [
21 2 ▶ map { $_->new_instance } (
Branch: 1 branch
BranchTrueFalseTotal
ref $referent ? : 0 2 2
22 ref($referent) ? ( @$referent ) : $class->component_classes
23 )
24 ];
25 2 bless $month_q, $class;
26 }
27  
28 0 ▶sub component_classes {
Subroutine component_classes: not called CC=1 SCAR=6.9
Pod undocumented
29 0 die "abstract!";
30 }
31  
32 # $quantity->init( $year, $month );
33 2 ▶sub init {
Subroutine init: called CC=1 SCAR=0.0
Pod undocumented
34 2 my $month_q = shift;
35
36 2 @$month_q = @_;
37 }
38  
39 1 1;
« Quantity/Abstract/Base.pm ↑ Summary Quantity/Number/Bytes.pm »