| 1 | package Data::Quantity::Abstract::Base; | ||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||
| 3 | 6 | require 5; | |||||||||||||||||||||||||||
| 4 | 6 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 5 | 6 | ▶ | use Carp; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 6 | 6 | ▶ | use Exporter; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||
| 8 | 6 | ▶ | use vars qw( $VERSION ); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 9 | 6 | $VERSION = 0.001; | |||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||
| 11 | # $quantity = Data::Quantity::Subclass->new( @_ ); | ||||||||||||||||||||||||||||
| 12 | 41 | ▶ | sub new { | ||||||||||||||||||||||||||
|
Subroutine
new: called CC=2 SCAR=7.2
Pod
undocumented
| |||||||||||||||||||||||||||||
| 13 | 41 | my $class_or_item = shift; | |||||||||||||||||||||||||||
| 14 | 41 | ▶ | my $class = ref $class_or_item || $class_or_item; | ||||||||||||||||||||||||||
|
Condition33%1/3
ref $class_or_item || $class_or_item
MC/DC0%0/2
ref $class_or_item || $class_or_item
ref $class_or_item
$class_or_item
Truth table33%1/3
A || B
A= ref $class_or_itemB= $class_or_item
| |||||||||||||||||||||||||||||
| 15 | 41 | my $quantity = $class->new_instance; | |||||||||||||||||||||||||||
| 16 | 41 | $quantity->init( @_ ); | |||||||||||||||||||||||||||
| 17 | 41 | return $quantity; | |||||||||||||||||||||||||||
| 18 | } | ||||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||
| 20 | # $empty_q = Data::Quantity::Subclass->new_instance(); | ||||||||||||||||||||||||||||
| 21 | 0 | ▶ | sub new_instance { | ||||||||||||||||||||||||||
|
Subroutine
new_instance: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 22 | 0 | croak "abstract"; | |||||||||||||||||||||||||||
| 23 | } | ||||||||||||||||||||||||||||
| 24 | |||||||||||||||||||||||||||||
| 25 | # $quantity->init( @_ ); | ||||||||||||||||||||||||||||
| 26 | 0 | ▶ | sub init { | ||||||||||||||||||||||||||
|
Subroutine
init: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 27 | 0 | croak "abstract"; | |||||||||||||||||||||||||||
| 28 | } | ||||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||
| 30 | 0 | ▶ | sub value { | ||||||||||||||||||||||||||
|
Subroutine
value: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 31 | 0 | croak "abstract"; | |||||||||||||||||||||||||||
| 32 | } | ||||||||||||||||||||||||||||
| 33 | |||||||||||||||||||||||||||||
| 34 | 0 | ▶ | sub scale { | ||||||||||||||||||||||||||
|
Subroutine
scale: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 35 | 0 | croak "abstract"; | |||||||||||||||||||||||||||
| 36 | } | ||||||||||||||||||||||||||||
| 37 | |||||||||||||||||||||||||||||
| 38 | |||||||||||||||||||||||||||||
| 39 | 37 | ▶ | sub import { | ||||||||||||||||||||||||||
|
Subroutine
import: called CC=3 SCAR=11.0
| |||||||||||||||||||||||||||||
| 40 | 37 | my $class = shift; | |||||||||||||||||||||||||||
| 41 | |||||||||||||||||||||||||||||
| 42 | 37 | ▶ | if ( scalar @_ == 1 and $_[0] eq '-isasubclass' ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
scalar @_ == 1 and $_[0] eq "-isasubclass"
MC/DC50%1/2
scalar @_ == 1 and $_[0] eq "-isasubclass"
scalar @_ == 1
$_[0] eq "-isasubclass"
Truth table66%2/3
A and B
A= scalar @_ == 1B= $_[0] eq "-isasubclass"
| |||||||||||||||||||||||||||||
| 43 | 25 | shift; | |||||||||||||||||||||||||||
| 44 | 25 | my $target_class = ( caller )[0]; | |||||||||||||||||||||||||||
| 45 | 6 | ▶ | no strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 46 | 25 | push @{"$target_class\::ISA"}, $class; | |||||||||||||||||||||||||||
| 47 | } | ||||||||||||||||||||||||||||
| 48 | |||||||||||||||||||||||||||||
| 49 | 37 | $class->SUPER::import( @_ ); | |||||||||||||||||||||||||||
| 50 | } | ||||||||||||||||||||||||||||
| 51 | |||||||||||||||||||||||||||||
| 52 | |||||||||||||||||||||||||||||
| 53 | 6 | 1; | |||||||||||||||||||||||||||