|  line  | 
 stmt  | 
 bran  | 
 cond  | 
 sub  | 
 pod  | 
 time  | 
 code  | 
| 
1
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 package Test::Mocha::Method;  | 
| 
2
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 # ABSTRACT: Objects to represent methods and their arguuments  | 
| 
3
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 $Test::Mocha::Method::VERSION = '0.66';  | 
| 
4
 | 
13
 | 
 
 | 
 
 | 
  
13
  
 | 
 
 | 
5627
 | 
 use strict;  | 
| 
 
 | 
13
 | 
 
 | 
 
 | 
 
 | 
 
 | 
31
 | 
    | 
| 
 
 | 
13
 | 
 
 | 
 
 | 
 
 | 
 
 | 
370
 | 
    | 
| 
5
 | 
13
 | 
 
 | 
 
 | 
  
13
  
 | 
 
 | 
68
 | 
 use warnings;  | 
| 
 
 | 
13
 | 
 
 | 
 
 | 
 
 | 
 
 | 
27
 | 
    | 
| 
 
 | 
13
 | 
 
 | 
 
 | 
 
 | 
 
 | 
312
 | 
    | 
| 
6
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
7
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 # smartmatch dependencies  | 
| 
8
 | 
13
 | 
 
 | 
 
 | 
  
13
  
 | 
 
 | 
249
 | 
 use 5.010001;  | 
| 
 
 | 
13
 | 
 
 | 
 
 | 
 
 | 
 
 | 
53
 | 
    | 
| 
9
 | 
13
 | 
 
 | 
 
 | 
  
13
  
 | 
 
 | 
6144
 | 
 use experimental 'smartmatch';  | 
| 
 
 | 
13
 | 
 
 | 
 
 | 
 
 | 
 
 | 
44994
 | 
    | 
| 
 
 | 
13
 | 
 
 | 
 
 | 
 
 | 
 
 | 
78
 | 
    | 
| 
10
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
11
 | 
13
 | 
 
 | 
 
 | 
  
13
  
 | 
 
 | 
891
 | 
 use Carp 'croak';  | 
| 
 
 | 
13
 | 
 
 | 
 
 | 
 
 | 
 
 | 
26
 | 
    | 
| 
 
 | 
13
 | 
 
 | 
 
 | 
 
 | 
 
 | 
647
 | 
    | 
| 
12
 | 
13
 | 
 
 | 
 
 | 
  
13
  
 | 
 
 | 
6248
 | 
 use Devel::PartialDump 0.17 ();  | 
| 
 
 | 
13
 | 
 
 | 
 
 | 
 
 | 
 
 | 
732938
 | 
    | 
| 
 
 | 
13
 | 
 
 | 
 
 | 
 
 | 
 
 | 
534
 | 
    | 
| 
13
 | 
13
 | 
 
 | 
 
 | 
  
13
  
 | 
 
 | 
114
 | 
 use Scalar::Util qw( blessed looks_like_number refaddr );  | 
| 
 
 | 
13
 | 
 
 | 
 
 | 
 
 | 
 
 | 
28
 | 
    | 
| 
 
 | 
13
 | 
 
 | 
 
 | 
 
 | 
 
 | 
1315
 | 
    | 
| 
14
 | 
13
 | 
 
 | 
 
 | 
  
13
  
 | 
 
 | 
5758
 | 
 use Test::Mocha::Types qw( Matcher Slurpy );  | 
| 
 
 | 
13
 | 
 
 | 
 
 | 
 
 | 
 
 | 
58
 | 
    | 
| 
 
 | 
13
 | 
 
 | 
 
 | 
 
 | 
 
 | 
167
 | 
    | 
| 
15
 | 
13
 | 
 
 | 
 
 | 
  
13
  
 | 
 
 | 
12725
 | 
 use Test::Mocha::Util 'check_slurpy_arg';  | 
| 
 
 | 
13
 | 
 
 | 
 
 | 
 
 | 
 
 | 
44
 | 
    | 
| 
 
 | 
13
 | 
 
 | 
 
 | 
 
 | 
 
 | 
826
 | 
    | 
| 
16
 | 
13
 | 
 
 | 
 
 | 
  
13
  
 | 
 
 | 
102
 | 
 use Types::Standard qw( ArrayRef HashRef Str );  | 
| 
 
 | 
13
 | 
 
 | 
 
 | 
 
 | 
 
 | 
38
 | 
    | 
| 
 
 | 
13
 | 
 
 | 
 
 | 
 
 | 
 
 | 
66
 | 
    | 
| 
17
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
18
 | 
13
 | 
 
 | 
 
 | 
  
13
  
 | 
 
 | 
9320
 | 
 use overload '""' => \&stringify, fallback => 1;  | 
| 
 
 | 
13
 | 
 
 | 
 
 | 
 
 | 
 
 | 
35
 | 
    | 
| 
 
 | 
13
 | 
 
 | 
 
 | 
 
 | 
 
 | 
90
 | 
    | 
| 
19
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
20
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 # cause string overloaded objects (Matchers) to be stringified  | 
| 
21
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 my $Dumper = Devel::PartialDump->new( objects => 0, stringify => 1 );  | 
| 
22
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
23
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 sub new {  | 
| 
24
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
     # uncoverable pod  | 
| 
25
 | 
481
 | 
 
 | 
 
 | 
  
481
  
 | 
  
0
  
 | 
1446
 | 
     my ( $class, %args ) = @_;  | 
| 
26
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
     ### assert: Str->check( $args{name} )  | 
| 
27
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
     ### assert: ArrayRef->check( $args{args} )  | 
| 
28
 | 
481
 | 
 
 | 
 
 | 
 
 | 
 
 | 
1658
 | 
     return bless \%args, $class;  | 
| 
29
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 }  | 
| 
30
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
31
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 sub name {  | 
| 
32
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
     # uncoverable pod  | 
| 
33
 | 
2122
 | 
 
 | 
 
 | 
  
2122
  
 | 
  
0
  
 | 
5945
 | 
     return $_[0]->{name};  | 
| 
34
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 }  | 
| 
35
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
36
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 sub args {  | 
| 
37
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
     # uncoverable pod  | 
| 
38
 | 
1049
 | 
 
 | 
 
 | 
  
1049
  
 | 
  
0
  
 | 
1336
 | 
     return @{ $_[0]->{args} };  | 
| 
 
 | 
1049
 | 
 
 | 
 
 | 
 
 | 
 
 | 
2426
 | 
    | 
| 
39
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 }  | 
| 
40
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
41
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 sub stringify {  | 
| 
42
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
     # """  | 
| 
43
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
     # Stringifies this method call to something that roughly resembles what  | 
| 
44
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
     # you'd type in Perl.  | 
| 
45
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
     # """  | 
| 
46
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
     # uncoverable pod  | 
| 
47
 | 
385
 | 
 
 | 
 
 | 
  
385
  
 | 
  
0
  
 | 
29378
 | 
     my ($self) = @_;  | 
| 
48
 | 
385
 | 
 
 | 
 
 | 
 
 | 
 
 | 
764
 | 
     return $self->name . '(' . $Dumper->dump( $self->args ) . ')';  | 
| 
49
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 }  | 
| 
50
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
51
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 sub __satisfied_by {  | 
| 
52
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
     # """  | 
| 
53
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
     # Returns true if the given C<$invocation> satisfies this method call.  | 
| 
54
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
     # """  | 
| 
55
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
     # uncoverable pod  | 
| 
56
 | 
691
 | 
 
 | 
 
 | 
  
691
  
 | 
 
 | 
1127
 | 
     my ( $self, $invocation ) = @_;  | 
| 
57
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
58
 | 
691
 | 
  
100
  
 | 
 
 | 
 
 | 
 
 | 
1115
 | 
     return unless $invocation->name eq $self->name;  | 
| 
59
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
60
 | 
332
 | 
 
 | 
 
 | 
 
 | 
 
 | 
739
 | 
     my @expected = $self->args;  | 
| 
61
 | 
332
 | 
 
 | 
 
 | 
 
 | 
 
 | 
564
 | 
     my @input    = $invocation->args;  | 
| 
62
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
     # invocation arguments can't be argument matchers  | 
| 
63
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
     ### assert: ! grep { Matcher->check($_) } @input  | 
| 
64
 | 
332
 | 
 
 | 
 
 | 
 
 | 
 
 | 
864
 | 
     check_slurpy_arg(@expected);  | 
| 
65
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
66
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
     # match @input against @expected which may include argument matchers  | 
| 
67
 | 
332
 | 
 
 | 
  
100
  
 | 
 
 | 
 
 | 
1229
 | 
     while ( @input && @expected ) {  | 
| 
68
 | 
241
 | 
 
 | 
 
 | 
 
 | 
 
 | 
477
 | 
         my $matcher = shift @expected;  | 
| 
69
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
70
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
         # slurpy argument matcher  | 
| 
71
 | 
241
 | 
  
100
  
 | 
 
 | 
 
 | 
 
 | 
506
 | 
         if ( Slurpy->check($matcher) ) {  | 
| 
 
 | 
 
 | 
  
100
  
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
72
 | 
35
 | 
 
 | 
 
 | 
 
 | 
 
 | 
814
 | 
             $matcher = $matcher->{slurpy};  | 
| 
73
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
             ### assert: $matcher->is_a_type_of(ArrayRef) || $matcher->is_a_type_of(HashRef)  | 
| 
74
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
75
 | 
35
 | 
 
 | 
 
 | 
 
 | 
 
 | 
51
 | 
             my $value;  | 
| 
76
 | 
35
 | 
  
100
  
 | 
 
 | 
 
 | 
 
 | 
87
 | 
             if ( $matcher->is_a_type_of(ArrayRef) ) {  | 
| 
 
 | 
 
 | 
  
 50
  
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
77
 | 
15
 | 
 
 | 
 
 | 
 
 | 
 
 | 
2774
 | 
                 $value = [@input];  | 
| 
78
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
             }  | 
| 
79
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
             elsif ( $matcher->is_a_type_of(HashRef) ) {  | 
| 
80
 | 
20
 | 
  
100
  
 | 
 
 | 
 
 | 
 
 | 
23933
 | 
                 return unless scalar(@input) % 2 == 0;  | 
| 
81
 | 
8
 | 
 
 | 
 
 | 
 
 | 
 
 | 
60
 | 
                 $value = {@input};  | 
| 
82
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
             }  | 
| 
83
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
             # else { invalid matcher type }  | 
| 
84
 | 
23
 | 
  
100
  
 | 
 
 | 
 
 | 
 
 | 
64
 | 
             return unless $matcher->check($value);  | 
| 
85
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
86
 | 
18
 | 
 
 | 
 
 | 
 
 | 
 
 | 
279
 | 
             @input = ();  | 
| 
87
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
         }  | 
| 
88
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
         # argument matcher  | 
| 
89
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
         elsif ( Matcher->check($matcher) ) {  | 
| 
90
 | 
67
 | 
  
100
  
 | 
 
 | 
 
 | 
 
 | 
2193
 | 
             return unless $matcher->check( shift @input );  | 
| 
91
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
         }  | 
| 
92
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
         # literal match  | 
| 
93
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
         else {  | 
| 
94
 | 
139
 | 
  
100
  
 | 
 
 | 
 
 | 
 
 | 
3150
 | 
             return unless _match( shift(@input), $matcher );  | 
| 
95
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
         }  | 
| 
96
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
     }  | 
| 
97
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
98
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
     # slurpy matcher should handle empty argument lists  | 
| 
99
 | 
253
 | 
  
100
  
 | 
  
100
  
 | 
 
 | 
 
 | 
2131
 | 
     if ( @expected > 0 && Slurpy->check( $expected[0] ) ) {  | 
| 
100
 | 
8
 | 
 
 | 
 
 | 
 
 | 
 
 | 
210
 | 
         my $matcher = shift(@expected)->{slurpy};  | 
| 
101
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
102
 | 
8
 | 
 
 | 
 
 | 
 
 | 
 
 | 
14
 | 
         my $value;  | 
| 
103
 | 
8
 | 
  
100
  
 | 
 
 | 
 
 | 
 
 | 
23
 | 
         if ( $matcher->is_a_type_of(ArrayRef) ) {  | 
| 
 
 | 
 
 | 
  
 50
  
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
104
 | 
6
 | 
 
 | 
 
 | 
 
 | 
 
 | 
447
 | 
             $value = [@input];  | 
| 
105
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
         }  | 
| 
106
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
         elsif ( $matcher->is_a_type_of(HashRef) ) {  | 
| 
107
 | 
2
 | 
  
 50
  
 | 
 
 | 
 
 | 
 
 | 
1394
 | 
             return unless scalar(@input) % 2 == 0;  | 
| 
108
 | 
2
 | 
 
 | 
 
 | 
 
 | 
 
 | 
6
 | 
             $value = {@input};  | 
| 
109
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
         }  | 
| 
110
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
         # else { invalid matcher type }  | 
| 
111
 | 
8
 | 
  
 50
  
 | 
 
 | 
 
 | 
 
 | 
24
 | 
         return unless $matcher->check($value);  | 
| 
112
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
     }  | 
| 
113
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
114
 | 
253
 | 
 
 | 
  
100
  
 | 
 
 | 
 
 | 
1731
 | 
     return @input == 0 && @expected == 0;  | 
| 
115
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 }  | 
| 
116
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
117
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 sub _match {  | 
| 
118
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
     # """Match 2 values for equality."""  | 
| 
119
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
     # uncoverable pod  | 
| 
120
 | 
162
 | 
 
 | 
 
 | 
  
162
  
 | 
 
 | 
306
 | 
     my ( $x, $y ) = @_;  | 
| 
121
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
122
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
     # This function uses smart matching, but we need to limit the scenarios  | 
| 
123
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
     # in which it is used because of its quirks.  | 
| 
124
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
125
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
     # ref types must match  | 
| 
126
 | 
162
 | 
  
100
  
 | 
 
 | 
 
 | 
 
 | 
428
 | 
     return if ref $x ne ref $y;  | 
| 
127
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
128
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
     # objects match only if they are the same object  | 
| 
129
 | 
139
 | 
  
100
  
 | 
  
100
  
 | 
 
 | 
 
 | 
629
 | 
     if ( blessed($x) || ref($x) eq 'CODE' ) {  | 
| 
130
 | 
5
 | 
 
 | 
 
 | 
 
 | 
 
 | 
36
 | 
         return refaddr($x) == refaddr($y);  | 
| 
131
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
     }  | 
| 
132
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
133
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
     # don't smartmatch on arrays because it recurses  | 
| 
134
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
     # which leads to the same quirks that we want to avoid  | 
| 
135
 | 
134
 | 
  
100
  
 | 
 
 | 
 
 | 
 
 | 
276
 | 
     if ( ref($x) eq 'ARRAY' ) {  | 
| 
136
 | 
7
 | 
  
100
  
 | 
 
 | 
 
 | 
 
 | 
8
 | 
         return if $#{$x} != $#{$y};  | 
| 
 
 | 
7
 | 
 
 | 
 
 | 
 
 | 
 
 | 
14
 | 
    | 
| 
 
 | 
7
 | 
 
 | 
 
 | 
 
 | 
 
 | 
13
 | 
    | 
| 
137
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
138
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
         # recurse to handle nested structures  | 
| 
139
 | 
6
 | 
 
 | 
 
 | 
 
 | 
 
 | 
12
 | 
         foreach ( 0 .. $#{$x} ) {  | 
| 
 
 | 
6
 | 
 
 | 
 
 | 
 
 | 
 
 | 
14
 | 
    | 
| 
140
 | 
17
 | 
  
100
  
 | 
 
 | 
 
 | 
 
 | 
34
 | 
             return if !_match( $x->[$_], $y->[$_] );  | 
| 
141
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
         }  | 
| 
142
 | 
4
 | 
 
 | 
 
 | 
 
 | 
 
 | 
15
 | 
         return 1;  | 
| 
143
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
     }  | 
| 
144
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
145
 | 
127
 | 
  
100
  
 | 
 
 | 
 
 | 
 
 | 
238
 | 
     if ( ref($x) eq 'HASH' ) {  | 
| 
146
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
         # smartmatch only matches the hash keys  | 
| 
147
 | 
4
 | 
  
100
  
 | 
 
 | 
 
 | 
 
 | 
18
 | 
         return if not $x ~~ $y;  | 
| 
148
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
149
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
         # ... but we want to match the hash values too  | 
| 
150
 | 
3
 | 
 
 | 
 
 | 
 
 | 
 
 | 
4
 | 
         foreach ( keys %{$x} ) {  | 
| 
 
 | 
3
 | 
 
 | 
 
 | 
 
 | 
 
 | 
10
 | 
    | 
| 
151
 | 
6
 | 
  
100
  
 | 
 
 | 
 
 | 
 
 | 
11
 | 
             return if !_match( $x->{$_}, $y->{$_} );  | 
| 
152
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
         }  | 
| 
153
 | 
2
 | 
 
 | 
 
 | 
 
 | 
 
 | 
35
 | 
         return 1;  | 
| 
154
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
     }  | 
| 
155
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
156
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
     # avoid smartmatch doing number matches on strings  | 
| 
157
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
     # e.g. '5x' ~~ 5 is true  | 
| 
158
 | 
123
 | 
  
100
  
 | 
  
100
  
 | 
 
 | 
 
 | 
561
 | 
     return if looks_like_number($x) xor looks_like_number($y);  | 
| 
159
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
160
 | 
119
 | 
 
 | 
 
 | 
 
 | 
 
 | 
568
 | 
     return $x ~~ $y;  | 
| 
161
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 }  | 
| 
162
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
163
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 1;  |