blib/lib/FindApp/Object/Behavior/Overloading.pm untested

filter: Statementstmt 0.0% 0 / 17 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 5 Podpod 0.0% 0 / 2 totaltotal 0.0% 0 / 24 CC 1 SCAR 6.9
CC
1
Cov
0%
op_eq
2.0
op_ne
2.0
BEGIN
2.0
CRAP 2.0
1 package FindApp::Object::Behavior::Overloading;
2  
3 use charnames qw(:full);
4  
5 use FindApp::Utils ":overload";
6  
7 use overload reverse (
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 );
15  
16 sub op_eq {
17 my($a, $b, $flipped) = @_;
18 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 for (($a_str, $b_str) = map {"$_"} $a, $b) {
25 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 return $a_str eq $b_str;
32 }
33  
34 sub op_ne { ! &op_eq }
35  
36 1;
37  
38 __END__