line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
1
|
|
|
1
|
|
876
|
use 5.008; |
|
1
|
|
|
|
|
5
|
|
|
1
|
|
|
|
|
51
|
|
2
|
1
|
|
|
1
|
|
6
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
36
|
|
3
|
1
|
|
|
1
|
|
15
|
use warnings; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
35
|
|
4
|
|
|
|
|
|
|
|
5
|
1
|
|
|
1
|
|
6
|
use Scalar::Util (); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
41
|
|
6
|
1
|
|
|
1
|
|
5
|
use Exporter (); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
130
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
package Test::Fatal::matchfor; |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
our $AUTHORITY = 'cpan:TOBYINK'; |
11
|
|
|
|
|
|
|
our $VERSION = '0.001'; |
12
|
|
|
|
|
|
|
our @EXPORT = qw( matchfor ); |
13
|
|
|
|
|
|
|
our @ISA = qw( Exporter ); |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
sub matchfor |
16
|
|
|
|
|
|
|
{ |
17
|
0
|
|
|
0
|
1
|
|
my @matchers = @_; |
18
|
0
|
|
|
|
|
|
bless \@matchers, do { |
19
|
|
|
|
|
|
|
package # |
20
|
|
|
|
|
|
|
Test::Fatal::matchfor::Internals::MATCHER; |
21
|
|
|
|
|
|
|
use overload |
22
|
1
|
|
|
|
|
8
|
q[==] => 'match', |
23
|
|
|
|
|
|
|
q[eq] => 'match', |
24
|
|
|
|
|
|
|
q[""] => 'to_string', |
25
|
1
|
|
|
1
|
|
5
|
fallback => 1; |
|
1
|
|
|
|
|
2
|
|
26
|
|
|
|
|
|
|
sub to_string { |
27
|
0
|
|
|
0
|
|
|
$_[0][0] |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
sub match { |
30
|
0
|
|
|
0
|
|
|
my ($self, $e) = @_; |
31
|
0
|
0
|
0
|
|
|
|
my $does = Scalar::Util::blessed($e) ? ($e->can('DOES') || $e->can('isa')) : undef; |
32
|
0
|
|
|
|
|
|
for my $s (@$self) { |
33
|
0
|
0
|
0
|
|
|
|
return 1 if ref($s) && $e =~ $s; |
34
|
0
|
0
|
0
|
|
|
|
return 1 if !ref($s) && $does && $e->$does($s); |
|
|
|
0
|
|
|
|
|
35
|
|
|
|
|
|
|
} |
36
|
0
|
|
|
|
|
|
return; |
37
|
|
|
|
|
|
|
} |
38
|
0
|
|
|
|
|
|
__PACKAGE__; |
39
|
|
|
|
|
|
|
}; |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
1; |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
__END__ |