Calculator/Command/Transformation.pm

filter: Statementstmt 50.0% 16 / 32 Branchbran 0.0% 0 / 4 Conditioncond 0.0% 0 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 71.4% 5 / 7 Podpod 100% 1 / 1 totaltotal 44.9% 22 / 49 CC 4 SCAR 16.7
CC
4
Cov
41%
_execute
12.0
new
6.0
BEGIN
1.0
CRAP 5.3
« Calculator/Command/Insertion.pm ↑ Summary Calculator/Command/DerivativeApplication.pm »
1 package Math::SymbolicX::Calculator::Command::Transformation;
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 base 'Math::SymbolicX::Calculator::Command';
Subroutine BEGIN: called CC=1 SCAR=0.0
7 1 ▶use Params::Util qw/_INSTANCE/;
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 1 our $VERSION = '0.02';
10  
11 0 ▶sub new {
Subroutine new: not called CC=2 SCAR=17.9
Pod documented
12 0 my $proto = shift;
13 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
14  
15 0 my %args = @_;
16 my $self = bless {
17 symbol => $args{symbol},
18 trafo => $args{object},
19 shallow => $args{shallow},
20 0 } => $class;
21  
22 0 return $self;
23 }
24  
25 0 ▶sub _execute {
Subroutine _execute: not called CC=3 SCAR=24.8
26 0 my $self = shift;
27 0 my $c = shift;
28
29 0 my $sym = $self->{symbol};
30 0 my $trafo = $self->{trafo};
31  
32 0 my $func = $c->{stash}{$sym};
33 0 ▶ if (_INSTANCE($func, 'Math::Symbolic::Custom::Transformation')) {
Branch: 1 branch
BranchTrueFalseTotal
if (&_INSTANCE($func, "Math::Symbolic::Custom::Transformation")) 0 0 0
34 0 return "Cannot apply transformation to another transformation '$sym'";
35 }
36  
37 0 ▶ if ($self->{shallow}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{'shallow'}) { } 0 0 0
38 0 $trafo->apply($func);
39 }
40 else {
41 0 $trafo->apply_recursive($func, $trafo);
42 }
43  
44 0 return($sym, '==', $func);
45 }
46  
47 1 1;
48  
49 __END__
« Calculator/Command/Insertion.pm ↑ Summary Calculator/Command/DerivativeApplication.pm »