| 1 | package DTL::Fast::Expression::Operator::Binary::Minus; | ||||||||||||||||||||||||||||||||||||||||||
| 2 | 2 | ▶ | use strict; use utf8; use warnings FATAL => 'all'; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 3 | 2 | ▶ | use parent 'DTL::Fast::Expression::Operator::Binary'; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||||||||||||||||
| 5 | 2 | $DTL::Fast::OPS_HANDLERS{'-'} = __PACKAGE__; | |||||||||||||||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||||||||||||||||
| 7 | 2 | ▶ | use Scalar::Util qw(looks_like_number); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||||||||||||||||
| 9 | sub dispatch | ||||||||||||||||||||||||||||||||||||||||||
| 10 | { | ||||||||||||||||||||||||||||||||||||||||||
| 11 | 42 | ▶ | my( $self, $arg1, $arg2, $context) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
dispatch: called CC=10 SCAR=40.4
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 12 | 42 | my ($arg1_type, $arg2_type) = (ref $arg1, ref $arg2); | |||||||||||||||||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||||||||||||||||
| 14 | 42 | ▶ | if( looks_like_number($arg1) and looks_like_number($arg2)) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 4 branches
Condition33%1/3
&looks_like_number($arg1) and &looks_like_number($arg2)
MC/DC0%0/2
&looks_like_number($arg1) and &looks_like_number($arg2)
&looks_like_number($arg1)
&looks_like_number($arg2)
Truth table33%1/3
A and B
A= &looks_like_number($arg1)B= &looks_like_number($arg2)
| |||||||||||||||||||||||||||||||||||||||||||
| 15 | { | ||||||||||||||||||||||||||||||||||||||||||
| 16 | 42 | return $arg1 - $arg2; | |||||||||||||||||||||||||||||||||||||||||
| 17 | } | ||||||||||||||||||||||||||||||||||||||||||
| 18 | elsif( $arg1_type eq 'ARRAY' ) # @todo array substitution | ||||||||||||||||||||||||||||||||||||||||||
| 19 | { | ||||||||||||||||||||||||||||||||||||||||||
| 20 | 0 | die $self->get_render_error( $context, 'arrays substitution not yet implemented'); | |||||||||||||||||||||||||||||||||||||||||
| 21 | } | ||||||||||||||||||||||||||||||||||||||||||
| 22 | elsif( $arg1_type eq 'HASH' ) # @todo hash substitution | ||||||||||||||||||||||||||||||||||||||||||
| 23 | { | ||||||||||||||||||||||||||||||||||||||||||
| 24 | 0 | die $self->get_render_error( $context, 'hashes substitution not yet implemented'); | |||||||||||||||||||||||||||||||||||||||||
| 25 | } | ||||||||||||||||||||||||||||||||||||||||||
| 26 | elsif( UNIVERSAL::can($arg1, 'minus')) | ||||||||||||||||||||||||||||||||||||||||||
| 27 | { | ||||||||||||||||||||||||||||||||||||||||||
| 28 | 0 | return $arg1->minus($arg2); | |||||||||||||||||||||||||||||||||||||||||
| 29 | } | ||||||||||||||||||||||||||||||||||||||||||
| 30 | else | ||||||||||||||||||||||||||||||||||||||||||
| 31 | { | ||||||||||||||||||||||||||||||||||||||||||
| 32 | 0 | ▶ | die $self->get_render_error( | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/8
$arg1 // "undef"
$arg1_type || 'SCALAR'
$arg2 // "undef"
$arg2_type || 'SCALAR'
MC/DC0%0/1
$arg1 // "undef"
$arg1
MC/DC0%0/1
$arg1_type || 'SCALAR'
$arg1_type
MC/DC0%0/1
$arg2 // "undef"
$arg2
MC/DC0%0/1
$arg2_type || 'SCALAR'
$arg2_type
Truth table0%0/2
A
A= $arg1
Truth table0%0/2
A
A= $arg1_type
Truth table0%0/2
A
A= $arg2
Truth table0%0/2
A
A= $arg2_type
| |||||||||||||||||||||||||||||||||||||||||||
| 33 | $context, | ||||||||||||||||||||||||||||||||||||||||||
| 34 | sprintf("don't know how to substitute %s (%s) from %s (%s)" | ||||||||||||||||||||||||||||||||||||||||||
| 35 | , $arg1 // 'undef' | ||||||||||||||||||||||||||||||||||||||||||
| 36 | , $arg1_type || 'SCALAR' | ||||||||||||||||||||||||||||||||||||||||||
| 37 | , $arg2 // 'undef' | ||||||||||||||||||||||||||||||||||||||||||
| 38 | , $arg2_type || 'SCALAR' | ||||||||||||||||||||||||||||||||||||||||||
| 39 | ) | ||||||||||||||||||||||||||||||||||||||||||
| 40 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 41 | } | ||||||||||||||||||||||||||||||||||||||||||
| 42 | } | ||||||||||||||||||||||||||||||||||||||||||
| 43 | |||||||||||||||||||||||||||||||||||||||||||
| 44 | 2 | 1; | |||||||||||||||||||||||||||||||||||||||||