line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Range::Object::String; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
# This is basically what common::sense does, but without the pragma itself |
4
|
|
|
|
|
|
|
# to remain compatible with Perls older than 5.8 |
5
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
26298
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
40
|
|
7
|
|
|
|
|
|
|
|
8
|
1
|
|
|
1
|
|
5
|
no warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
57
|
|
9
|
1
|
|
|
|
|
72
|
use warnings qw(FATAL closed internal debugging pack malloc portable |
10
|
|
|
|
|
|
|
prototype inplace io pipe unpack deprecated glob digit |
11
|
1
|
|
|
1
|
|
9
|
printf reserved taint closure semicolon); |
|
1
|
|
|
|
|
6
|
|
12
|
1
|
|
|
1
|
|
4
|
no warnings qw(exec newline unopened); |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
23
|
|
13
|
|
|
|
|
|
|
|
14
|
1
|
|
|
1
|
|
5
|
use Carp; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
94
|
|
15
|
|
|
|
|
|
|
|
16
|
1
|
|
|
1
|
|
5
|
use base qw(Range::Object); |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
536
|
|
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
# Overload definitions |
19
|
|
|
|
|
|
|
|
20
|
1
|
|
|
|
|
5
|
use overload q{""} => 'stringify', |
21
|
1
|
|
|
1
|
|
1445
|
fallback => 1; |
|
1
|
|
|
|
|
1002
|
|
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
### PUBLIC INSTANCE METHOD ### |
24
|
|
|
|
|
|
|
# |
25
|
|
|
|
|
|
|
# Returns regex for matching strings -- any strings. |
26
|
|
|
|
|
|
|
# |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
sub pattern { |
29
|
52
|
|
|
52
|
1
|
242
|
return qr/\A .* \z/xms |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
### PUBLIC INSTANCE METHOD ### |
33
|
|
|
|
|
|
|
# |
34
|
|
|
|
|
|
|
# Returns regex that is used to separate items in a range list. |
35
|
|
|
|
|
|
|
# Default for Strings are \r, \n or \t. |
36
|
|
|
|
|
|
|
# |
37
|
|
|
|
|
|
|
|
38
|
52
|
|
|
52
|
1
|
179
|
sub separator { qr/ [\r\n\t] /xms } |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
### PUBLIC INSTANCE METHOD ### |
41
|
|
|
|
|
|
|
# |
42
|
|
|
|
|
|
|
# Returns default range delimiter; Strings use newline ("\n"). |
43
|
|
|
|
|
|
|
# |
44
|
|
|
|
|
|
|
|
45
|
24
|
|
|
24
|
1
|
46
|
sub delimiter { "\n" } |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
############## PRIVATE METHODS BELOW ############## |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
### PRIVATE INSTANCE METHOD ### |
50
|
|
|
|
|
|
|
# |
51
|
|
|
|
|
|
|
# Returns default list separator for use with stringify() and |
52
|
|
|
|
|
|
|
# stringify_collapsed() |
53
|
|
|
|
|
|
|
# |
54
|
|
|
|
|
|
|
|
55
|
18
|
|
|
18
|
|
58
|
sub _list_separator { "\n" } |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
### PRIVATE INSTANCE METHOD ### |
58
|
|
|
|
|
|
|
# |
59
|
|
|
|
|
|
|
# Expands a list of items using Perl range operator. |
60
|
|
|
|
|
|
|
# Does nothing for Strings. |
61
|
|
|
|
|
|
|
# |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
sub _explode_range { |
64
|
106
|
|
|
106
|
|
137
|
my ($self, $string) = @_; |
65
|
|
|
|
|
|
|
|
66
|
106
|
|
|
|
|
369
|
return ($string); |
67
|
|
|
|
|
|
|
} |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
### PRIVATE INSTANCE METHOD ### |
70
|
|
|
|
|
|
|
# |
71
|
|
|
|
|
|
|
# Tests if two values are equal. |
72
|
|
|
|
|
|
|
# |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
sub _equal_value { |
75
|
362
|
|
|
362
|
|
483
|
my ($self, $first, $last) = @_; |
76
|
|
|
|
|
|
|
|
77
|
362
|
|
|
|
|
1075
|
return !!($first eq $last); |
78
|
|
|
|
|
|
|
} |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
### PRIVATE INSTANCE METHOD ### |
81
|
|
|
|
|
|
|
# |
82
|
|
|
|
|
|
|
# Tests if two values are consequent. Since string ranges are actually |
83
|
|
|
|
|
|
|
# disjointed collections, this method does nothing. |
84
|
|
|
|
|
|
|
# |
85
|
|
|
|
|
|
|
|
86
|
24
|
|
|
24
|
|
64
|
sub _next_in_range { return; } |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
1; |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
__END__ |