FindApp/Object/Behavior/Overloading.pm

filter: Statementstmt 43.4% 10 / 23 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 50.0% 3 / 6 Podpod 100% 3 / 3 totaltotal 50.0% 16 / 32 CC 3 SCAR 12.9
CC
3
Cov
43%
op_eq
6.0
op_eq
6.0
op_ne
2.0
CRAP 3.6
« FindApp/Utils/Syntax.pm ↑ Summary FindApp/Object/State/Group/State/Dirs.pm »
1 package FindApp::Object::Behavior::Overloading;
2  
3 6 ▶use charnames qw(:full);
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 6 ▶use FindApp::Utils ":overload";
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 6 ▶use overload reverse (
Subroutine BEGIN: called CC=1 SCAR=0.0
8 as_string => qw( "" ),
9 as_number => qw( 0+ ),
10 op_equals => qw( == ),
11 op_notequals => qw( != ),
12 op_eq => qw( eq ),
13 op_ne => qw( ne ),
14 6 );
15  
16 0 ▶sub op_eq {
Subroutine op_eq: not called CC=2 SCAR=17.9
Pod documented
17 0 ▶ my($a, $b, $flipped) = @_;
Subroutine op_eq: not called CC=2 SCAR=17.9
Pod documented
18 0 my($a_str, $b_str);
19  
20 # bless({ # FindApp::Object=HASH(0x7f9a630cd6f0)
21 # bless([], "FindApp::Object::State::Group::State::Dirs"); # FindApp::Object::State::Group::State::Dirs=ARRAY(0x7f8f8480e8c0)
22  
23 # have to trim the uniquifying address that as_string adds
24 0 for (($a_str, $b_str) = map {"$_"} $a, $b) {
25 0 s{
26 \A .* \K # first line, keep it
27 \N{SPACE} \N{NUMBER SIGN} \N{SPACE} # then
28 \w+ (?: ::\w+ )* = \p{upper}+ \( 0x \p{ahex}+ \) (?= \n)
29 }[]x ;
30 }
31 0 return $a_str eq $b_str;
32 }
33  
34 0 ▶sub op_ne { ! &op_eq }
Subroutine op_ne: not called CC=1 SCAR=6.9
Pod documented
35  
36 6 1;
37  
38 __END__
« FindApp/Utils/Syntax.pm ↑ Summary FindApp/Object/State/Group/State/Dirs.pm »