| 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
MC/DC0%0/2
ref $proto || $proto
ref $proto
$proto
Truth table0%0/3
A || B
A= ref $protoB= $proto
| |||||||||||||||||||||
| 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
| |||||||||||||||||||||
| 34 | 0 | return "Cannot apply transformation to another transformation '$sym'"; | |||||||||||||||||||
| 35 | } | ||||||||||||||||||||
| 36 | |||||||||||||||||||||
| 37 | 0 | ▶ | if ($self->{shallow}) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 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__ | ||||||||||||||||||||