| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Regexp::Flow::Results; |
|
2
|
1
|
|
|
1
|
|
6
|
use strict; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
40
|
|
|
3
|
1
|
|
|
1
|
|
6
|
use warnings; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
28
|
|
|
4
|
1
|
|
|
1
|
|
18
|
use Moo; |
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
6
|
|
|
5
|
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
=head1 NAME |
|
7
|
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
Regexp::Flow::Results - contains Regexp::Flow::Result objects |
|
9
|
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
11
|
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
The purpose of this class is to act as a container for |
|
13
|
|
|
|
|
|
|
C objects. The reason it is not a simple arrayref |
|
14
|
|
|
|
|
|
|
is that is is convenient to be able to consider its boolean and integer |
|
15
|
|
|
|
|
|
|
value, just like the result of C. |
|
16
|
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
=head1 OVERLOADING |
|
18
|
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
It can be treated as a plain arrayref, in which case it accesses its |
|
20
|
|
|
|
|
|
|
contents. |
|
21
|
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
It can be treated as a boolean or integer, in which cases it returns |
|
23
|
|
|
|
|
|
|
the number of matches in the contents. |
|
24
|
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
=cut |
|
26
|
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
use overload |
|
28
|
0
|
|
|
0
|
|
0
|
'0+' => \&count, |
|
29
|
|
|
|
|
|
|
'@{}' => sub {shift->contents}, #~ not sure why, but \&contents dies |
|
30
|
1
|
|
|
|
|
18
|
nomethod => \&count |
|
31
|
1
|
|
|
1
|
|
359
|
; |
|
|
1
|
|
|
|
|
2
|
|
|
32
|
|
|
|
|
|
|
=head3 METHODS |
|
33
|
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
=cut |
|
35
|
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
=head3 contents |
|
37
|
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
An arrayref, empty by default, but which will contain information on |
|
39
|
|
|
|
|
|
|
each successful match, as C objects. |
|
40
|
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
=cut |
|
42
|
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
has contents => ( |
|
44
|
|
|
|
|
|
|
is => 'rw', |
|
45
|
|
|
|
|
|
|
default => sub {[]}, |
|
46
|
|
|
|
|
|
|
); |
|
47
|
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
=head3 count |
|
49
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
A utility function which returns the number of successful matches. |
|
51
|
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
To be determined: does this inspect them for success? |
|
53
|
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
=cut |
|
55
|
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
sub count { |
|
57
|
5
|
|
|
5
|
1
|
326
|
return scalar @{shift->contents}; |
|
|
5
|
|
|
|
|
20
|
|
|
58
|
|
|
|
|
|
|
} |
|
59
|
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
=head3 succes |
|
61
|
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
A utility function which returns true or false depending on whether |
|
63
|
|
|
|
|
|
|
there were successful matches. |
|
64
|
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
To be determined: does this inspect them for success? |
|
66
|
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
=cut |
|
68
|
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
sub success { |
|
70
|
0
|
0
|
|
0
|
0
|
|
return shift->count ? 1 : 0; |
|
71
|
|
|
|
|
|
|
} |
|
72
|
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
=head1 SEE ALSO |
|
74
|
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
Regexp::Flow - which uses this module |
|
76
|
|
|
|
|
|
|
(also for author and copyright information) |
|
77
|
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
=cut |
|
79
|
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
1; |
|
81
|
|
|
|
|
|
|
|