| 1 | #-*- Mode: CPerl -*- | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | ## File: DTA::CAB::Unify.pm | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | ## Author: Bryan Jurish <moocow@cpan.org> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | ## Description: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | ## + Unification utiltities (copied from Taxi::Mysql::Unify) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | ##====================================================================== | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | package DTA::CAB::Unify; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | 1 | ▶ | use Exporter; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | 1 | ▶ | use Carp; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | 1 | ▶ | use UNIVERSAL; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | 1 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | 1 | ▶ | BEGIN { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | 1 | *isa = \&UNIVERSAL::isa; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | 1 | *can = \&UNIVERSAL::can; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | ##====================================================================== | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | ## Globals | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | ## $TOP | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | ## scalar used by _unify() and friends for incompatible unifications | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | 1 | our $TOP = '__TOP__'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | 1 | our @ISA = qw(Exporter); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | ## @EXPORT | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | ## By default, unify(), unifyClobber(), unifyClone() are exported | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | 1 | our @EXPORT = qw(unify unifyClobber unifyClone); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | ## %EXPORT_TAGS | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | ## Known tags: :default (see @EXPORT), :misc (_unify* subs), :all (everything) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | 1 | our %EXPORT_TAGS = | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | 'default' =>['unify','unifyClobber','unifyClone'], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | 'misc' =>['_unify', '_unifyClobber', '_unify_guts', '_unify1_top', '_unify1_clobber'], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | 1 | $EXPORT_TAGS{all} = [map { @$_ } values(%EXPORT_TAGS)]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | 1 | our @EXPORT_OK = @{$EXPORT_TAGS{all}}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | ##====================================================================== | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | ## API: Unification | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | ## $xnew = unifyClone($x) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | ## + wrapper for Storable::dclone() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | 0 | ▶ | sub unifyClone { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
unifyClone: not called CC=4 SCAR=30.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | 0 | ▶ | if (!defined($_[0])) { return undef; } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | 0 | elsif (!ref($_[0])) { return "$_[0]" } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | 0 | elsif (can($_[0],'clone')) { return $_[0]->clone; } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | 0 | else { Storable::dclone($_[0]); } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | ## $xnew = unifyClone_($x) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | ## + re-implemented to avoid Storable::dclone() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | ## + seems to cause infinite load-loop and memory-gobble in cab server: why? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | 0 | ▶ | sub unifyClone_ { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
unifyClone_: not called CC=8 SCAR=42.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | 0 | ▶ | if (!defined($_[0])) { return undef; } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 5 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | 0 | elsif (!ref($_[0])) { return "$_[0]" } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | 0 | elsif (isa($_[0],'REGEXP')) { return qr($_[0]); } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | 0 | ▶ | elsif (isa($_[0],'HASH')) { my $tmp={ map {unifyClone($_)} %{$_[0]} }; return ref($_[0]) eq 'HASH' ? $tmp : bless($tmp,ref($_[0])); } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | 0 | ▶ | elsif (isa($_[0],'ARRAY')) { my $tmp=[ map {unifyClone($_)} @{$_[0]} ]; return ref($_[0]) eq 'ARRAY' ? $tmp : bless($tmp,ref($_[0])); } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | 0 | else { return $_[0]; } ##-- cowardly refuse to clone GLOBs, CODE-refs, etc | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 66 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 67 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 68 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 69 | ## $xy = unify($x,$y, $OUTPUT_TOP) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 70 | 0 | ▶ | sub unify { return _unify_guts(unifyClone($_[0]),unifyClone($_[1]),\&_unify1_top, @_[2..$#_]); } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
unify: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 71 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 72 | ## $xy = unifyClobber($x,$y, $OUTPUT_TOP) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 73 | ## + clobbers old values of $x with new values from $y if unification would produce $TOP | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 74 | 0 | ▶ | sub unifyClobber { return _unify_guts(unifyClone($_[0]),unifyClone($_[1]),\&_unify1_clobber, @_[2..$#_]); } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
unifyClobber: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 75 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 76 | ## $xy = _unify($x,$y, $OUTPUT_TOP) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 77 | ## + destructively alters $x, adopts literal references from $y where possible | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 78 | ## + does *NOT* clobber defined values in $x with undef values in $y! | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 79 | ## - to clobber defined $x values with undef in $y, set $y values to $TOP and pass $OUTPUT_TOP=undef | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 80 | 0 | ▶ | sub _unify { return _unify_guts($_[0],$_[1],\&_unify1_top, @_[2..$#_]); } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_unify: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 81 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 82 | ## $xy = _unifyClobber($x,$y) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 83 | ## + destructively alters $x, adopts literal references from $y where possible | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 84 | 0 | ▶ | sub _unifyClobber { return _unify_guts($_[0],$_[1],\&_unify1_clobber, @_[2..$#_]); } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_unifyClobber: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 85 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 86 | ## $x_altered = _unify_guts($x,$y,\&unify1_sub) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 87 | ## + destructively alters $x, adopts literal references from $y where possible | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 88 | 0 | ▶ | sub _unify_guts { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_unify_guts: not called CC=29 SCAR=67.7
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 89 | 0 | my ($x0,$y0,$uscalar,$topout) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 90 | 0 | ▶ | $topout = $TOP if (!exists($_[3])); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 91 | 0 | ▶ | $uscalar = \&_unify1_top if (!defined($uscalar)); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 92 | 0 | my @eqr = (\$x0,\$y0); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 93 | 0 | my ($x,$y); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 94 | 0 | ▶ | while (@eqr) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 95 | 0 | ($x,$y) = splice(@eqr,0,2); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 96 | ## | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 97 | 0 | ▶ | if (defined($$x) && $$x eq $TOP) { $$x=$topout; } ##-- Case: (TOP,$y) -> $OUTPUT_TOP | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 10 branches
Condition0%0/3
defined $$x and $$x eq $DTA::CAB::Unify::TOP
MC/DC0%0/2
defined $$x and $$x eq $DTA::CAB::Unify::TOP
defined $$x
$$x eq $DTA::CAB::Unify::TOP
Truth table0%0/3
A and B
A= defined $$xB= $$x eq $DTA::CAB::Unify::TOP
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 98 | 0 | ▶ | elsif (defined($$y) && $$y eq $TOP) { $$x=$topout; } ##-- Case: (TOP,$y) -> $OUTPUT_TOP | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
defined $$y and $$y eq $DTA::CAB::Unify::TOP
MC/DC0%0/2
defined $$y and $$y eq $DTA::CAB::Unify::TOP
defined $$y
$$y eq $DTA::CAB::Unify::TOP
Truth table0%0/3
A and B
A= defined $$yB= $$y eq $DTA::CAB::Unify::TOP
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 99 | 0 | elsif (!defined($$x)) { $$x=$$y; } ##-- Case: (undef,$y) -> $y | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 100 | 0 | elsif (!defined($$y)) { next; } ##-- Case: ($x,undef) -> $x | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 101 | ▶ | elsif (isa($$x,'HASH') && isa($$y,'HASH')) { ##-- Case: (\%x,\%y) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
DTA::CAB::Unify::isa($$x, "HASH") and DTA::CAB::Unify::isa($$y, "HASH")
MC/DC0%0/2
DTA::CAB::Unify::isa($$x, "HASH") and DTA::CAB::Unify::isa($$y, "HASH")
DTA::CAB::Unify::isa($$x, "HASH")
DTA::CAB::Unify::isa($$y, "HASH")
Truth table0%0/3
A and B
A= DTA::CAB::Unify::isa($$x, "HASH")B= DTA::CAB::Unify::isa($$y, "HASH")
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 102 | 0 | push(@eqr, map { (\$$x->{$_},\$$y->{$_}) } keys(%$$y)); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 103 | 0 | ▶ | bless($$x,ref($$y)) if (ref($$y) ne 'HASH'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 104 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 105 | ▶ | elsif (isa($$x,'ARRAY') && isa($$x,'ARRAY')) { ##-- Case: (\@x,\@y) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
DTA::CAB::Unify::isa($$x, "ARRAY") and DTA::CAB::Unify::isa($$x, "ARRAY")
MC/DC0%0/2
DTA::CAB::Unify::isa($$x, "ARRAY") and DTA::CAB::Unify::isa($$x, "ARRAY")
DTA::CAB::Unify::isa($$x, "ARRAY")
DTA::CAB::Unify::isa($$x, "ARRAY")
Truth table0%0/3
A and B
A= DTA::CAB::Unify::isa($$x, "ARRAY")B= DTA::CAB::Unify::isa($$x, "ARRAY")
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 106 | push(@eqr, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 107 | 0 | map { (\$$x->[$_],\$$y->[$_]) } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 108 | 0 | ▶ | grep { exists($$x->[$_]) || exists($$y->[$_]) } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
exists $$x->[$_] || exists $$y->[$_]
MC/DC0%0/2
exists $$x->[$_] || exists $$y->[$_]
exists $$x->[$_]
exists $$y->[$_]
Truth table0%0/3
A || B
A= exists $$x->[$_]B= exists $$y->[$_]
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 109 | (0..($#$$x > $#$$y ? $#$$x : $#$$y)) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 110 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 111 | 0 | ▶ | bless($$x,ref($$y)) if (ref($$y) ne 'ARRAY'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 112 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 113 | ▶ | elsif (!ref($$x) && !ref($$y)) { ##-- Case: ($x,$y) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
ref $$x || ref $$y
MC/DC0%0/2
ref $$x || ref $$y
ref $$x
ref $$y
Truth table0%0/3
A || B
A= ref $$xB= ref $$y
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 114 | 0 | $$x = $uscalar->($$x,$$y); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 115 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 116 | ▶ | elsif (UNIVERSAL::isa($$x,'Regexp') || UNIVERSAL::isa($$y,'Regexp')) { ##-- Case: (qr//,qr//) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
UNIVERSAL::isa($$x, "Regexp") or UNIVERSAL::isa($$y, "Regexp")
MC/DC0%0/2
UNIVERSAL::isa($$x, "Regexp") or UNIVERSAL::isa($$y, "Regexp")
UNIVERSAL::isa($$x, "Regexp")
UNIVERSAL::isa($$y, "Regexp")
Truth table0%0/3
A or B
A= UNIVERSAL::isa($$x, "Regexp")B= UNIVERSAL::isa($$y, "Regexp")
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 117 | 0 | $$x = $uscalar->($$x,$$y); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 118 | 0 | ▶ | bless($$x,ref($$y)) if (ref($$y) ne 'Regexp'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 119 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 120 | ▶ | elsif (isa($$x,'REF') && isa($$y,'REF')) { ##-- Case: (\\?x,\\?y) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
DTA::CAB::Unify::isa($$x, "REF") and DTA::CAB::Unify::isa($$y, "REF")
MC/DC0%0/2
DTA::CAB::Unify::isa($$x, "REF") and DTA::CAB::Unify::isa($$y, "REF")
DTA::CAB::Unify::isa($$x, "REF")
DTA::CAB::Unify::isa($$y, "REF")
Truth table0%0/3
A and B
A= DTA::CAB::Unify::isa($$x, "REF")B= DTA::CAB::Unify::isa($$y, "REF")
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 121 | 0 | push(@eqr, $$x,$$y); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 122 | 0 | ▶ | bless($$x,ref($$y)) if (ref($$y) ne 'REF'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 123 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 124 | ▶ | elsif (isa($$x,'SCALAR') && isa($$y,'SCALAR')) { ##-- Case: (\$x,\$y) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
DTA::CAB::Unify::isa($$x, "SCALAR") and DTA::CAB::Unify::isa($$y, "SCALAR")
MC/DC0%0/2
DTA::CAB::Unify::isa($$x, "SCALAR") and DTA::CAB::Unify::isa($$y, "SCALAR")
DTA::CAB::Unify::isa($$x, "SCALAR")
DTA::CAB::Unify::isa($$y, "SCALAR")
Truth table0%0/3
A and B
A= DTA::CAB::Unify::isa($$x, "SCALAR")B= DTA::CAB::Unify::isa($$y, "SCALAR")
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 125 | 0 | push(@eqr, $$x,$$y); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 126 | 0 | ▶ | bless($$x,ref($$y)) if (ref($$y) ne 'SCALAR'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 127 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 128 | else { ##-- Case: ? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 129 | #carp( __PACKAGE__ . "::_unify_guts(): don't know how to unify (x=$x, y=$y): treating as scalars"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 130 | 0 | $$x = $uscalar->($$x,$$y); ##-- default: treat as scalars | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 131 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 132 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 133 | 0 | return $x0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 134 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 135 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 136 | ## $xval = _unify1_top($x,$y) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 137 | ## + called for simple scalars | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 138 | 0 | ▶ | sub _unify1_top { return $_[0] eq $_[1] ? $_[0] : $TOP; } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_unify1_top: not called CC=2 SCAR=17.9
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 139 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 140 | ## $xval = _unify1_clobber($x,$y) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 141 | ## + called for simple scalars | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 142 | ## + maps TOP to undef | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 143 | 0 | ▶ | sub _unify1_clobber { return $_[1]; } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_unify1_clobber: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 144 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 145 | 1 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 146 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 147 | __END__ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||