line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# ABSTRACT: Result Object for Perl 5 |
2
|
|
|
|
|
|
|
package Data::Object::Regexp::Result; |
3
|
|
|
|
|
|
|
|
4
|
7
|
|
|
7
|
|
130
|
use 5.010; |
|
7
|
|
|
|
|
19
|
|
5
|
7
|
|
|
7
|
|
31
|
use Data::Object::Class; |
|
7
|
|
|
|
|
13
|
|
|
7
|
|
|
|
|
45
|
|
6
|
|
|
|
|
|
|
|
7
|
7
|
|
|
7
|
|
1783
|
use Data::Object 'deduce_deep'; |
|
7
|
|
|
|
|
11
|
|
|
7
|
|
|
|
|
4490
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
extends 'Data::Object::Array'; |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
our $VERSION = '0.42'; # VERSION |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sub captures { |
14
|
2
|
|
|
2
|
1
|
340
|
my $self = shift; |
15
|
2
|
|
|
|
|
7
|
my $string = $self->initial; |
16
|
|
|
|
|
|
|
|
17
|
2
|
|
|
|
|
7
|
my $last_match_start = $self->last_match_start; |
18
|
2
|
|
|
|
|
6
|
my $last_match_end = $self->last_match_end; |
19
|
|
|
|
|
|
|
|
20
|
2
|
|
|
|
|
4
|
my @captures; |
21
|
|
|
|
|
|
|
|
22
|
2
|
|
|
|
|
6
|
for (my $i = 1; $i < @$last_match_end; $i++) { |
23
|
4
|
|
100
|
|
|
62
|
my $start = $last_match_start->[$i] || 0; |
24
|
4
|
|
50
|
|
|
12
|
my $end = $last_match_end->[$i] || 0; |
25
|
|
|
|
|
|
|
|
26
|
4
|
|
|
|
|
55
|
push @captures, substr "$string", $start, $end - $start; |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
|
29
|
2
|
|
|
|
|
8
|
return deduce_deep [@captures]; |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
sub count { |
33
|
2
|
|
|
2
|
1
|
10
|
my $self = shift; |
34
|
2
|
|
|
|
|
8
|
return deduce_deep $self->[2]; |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
sub initial { |
38
|
5
|
|
|
5
|
1
|
7
|
my $self = shift; |
39
|
5
|
|
|
|
|
19
|
return deduce_deep $self->[6]; |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
sub last_match_end { |
43
|
5
|
|
|
5
|
1
|
6
|
my $self = shift; |
44
|
5
|
|
|
|
|
16
|
return deduce_deep $self->[4]; |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
sub last_match_start { |
48
|
5
|
|
|
5
|
1
|
9
|
my $self = shift; |
49
|
5
|
|
|
|
|
17
|
return deduce_deep $self->[3]; |
50
|
|
|
|
|
|
|
} |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
sub named_captures { |
53
|
6
|
|
|
6
|
1
|
12
|
my $self = shift; |
54
|
6
|
|
|
|
|
17
|
return deduce_deep $self->[5]; |
55
|
|
|
|
|
|
|
} |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
sub matched { |
58
|
1
|
|
|
1
|
1
|
3
|
my $self = shift; |
59
|
1
|
|
|
|
|
5
|
my $string = $self->initial; |
60
|
|
|
|
|
|
|
|
61
|
1
|
|
|
|
|
101
|
my $last_match_start = $self->last_match_start; |
62
|
1
|
|
|
|
|
7
|
my $last_match_end = $self->last_match_end; |
63
|
|
|
|
|
|
|
|
64
|
1
|
|
50
|
|
|
49
|
my $start = $last_match_start->[0] || 0; |
65
|
1
|
|
50
|
|
|
3
|
my $end = $last_match_end->[0] || 0; |
66
|
|
|
|
|
|
|
|
67
|
1
|
|
|
|
|
5
|
return deduce_deep substr "$string", $start, $end - $start; |
68
|
|
|
|
|
|
|
} |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
sub prematched { |
71
|
1
|
|
|
1
|
1
|
3
|
my $self = shift; |
72
|
1
|
|
|
|
|
5
|
my $string = $self->initial; |
73
|
|
|
|
|
|
|
|
74
|
1
|
|
|
|
|
4
|
my $last_match_start = $self->last_match_start; |
75
|
1
|
|
|
|
|
4
|
my $last_match_end = $self->last_match_end; |
76
|
|
|
|
|
|
|
|
77
|
1
|
|
50
|
|
|
4
|
my $start = $last_match_start->[0] || 0; |
78
|
1
|
|
50
|
|
|
4
|
my $end = $last_match_end->[0] || 0; |
79
|
|
|
|
|
|
|
|
80
|
1
|
|
|
|
|
3
|
return deduce_deep substr "$string", 0, $start; |
81
|
|
|
|
|
|
|
} |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
sub postmatched { |
84
|
1
|
|
|
1
|
1
|
2
|
my $self = shift; |
85
|
1
|
|
|
|
|
4
|
my $string = $self->initial; |
86
|
|
|
|
|
|
|
|
87
|
1
|
|
|
|
|
4
|
my $last_match_start = $self->last_match_start; |
88
|
1
|
|
|
|
|
4
|
my $last_match_end = $self->last_match_end; |
89
|
|
|
|
|
|
|
|
90
|
1
|
|
50
|
|
|
4
|
my $start = $last_match_start->[0] || 0; |
91
|
1
|
|
50
|
|
|
4
|
my $end = $last_match_end->[0] || 0; |
92
|
|
|
|
|
|
|
|
93
|
1
|
|
|
|
|
3
|
return deduce_deep substr "$string", $end; |
94
|
|
|
|
|
|
|
} |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
sub regexp { |
97
|
1
|
|
|
1
|
1
|
2
|
my $self = shift; |
98
|
1
|
|
|
|
|
4
|
return deduce_deep $self->[0]; |
99
|
|
|
|
|
|
|
} |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
sub string { |
102
|
5
|
|
|
5
|
1
|
344
|
my $self = shift; |
103
|
5
|
|
|
|
|
24
|
return deduce_deep $self->[1]; |
104
|
|
|
|
|
|
|
} |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
1; |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
__END__ |