| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Venus::Name; |
|
2
|
|
|
|
|
|
|
|
|
3
|
19
|
|
|
19
|
|
364
|
use 5.018; |
|
|
19
|
|
|
|
|
76
|
|
|
4
|
|
|
|
|
|
|
|
|
5
|
19
|
|
|
19
|
|
312
|
use strict; |
|
|
19
|
|
|
|
|
189
|
|
|
|
19
|
|
|
|
|
482
|
|
|
6
|
19
|
|
|
19
|
|
108
|
use warnings; |
|
|
19
|
|
|
|
|
62
|
|
|
|
19
|
|
|
|
|
635
|
|
|
7
|
|
|
|
|
|
|
|
|
8
|
19
|
|
|
19
|
|
120
|
use Venus::Class 'base', 'with'; |
|
|
19
|
|
|
|
|
62
|
|
|
|
19
|
|
|
|
|
122
|
|
|
9
|
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
base 'Venus::Kind::Utility'; |
|
11
|
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
with 'Venus::Role::Valuable'; |
|
13
|
|
|
|
|
|
|
with 'Venus::Role::Buildable'; |
|
14
|
|
|
|
|
|
|
with 'Venus::Role::Accessible'; |
|
15
|
|
|
|
|
|
|
with 'Venus::Role::Explainable'; |
|
16
|
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
use overload ( |
|
18
|
|
|
|
|
|
|
'""' => 'explain', |
|
19
|
3
|
|
|
3
|
|
23
|
'eq' => sub{$_[0]->value eq "$_[1]"}, |
|
20
|
2
|
|
|
2
|
|
10
|
'ne' => sub{$_[0]->value ne "$_[1]"}, |
|
21
|
1
|
|
|
1
|
|
5
|
'qr' => sub{qr/@{[quotemeta($_[0]->value)]}/}, |
|
|
1
|
|
|
|
|
5
|
|
|
22
|
19
|
|
|
|
|
346
|
'~~' => 'explain', |
|
23
|
|
|
|
|
|
|
fallback => 1, |
|
24
|
19
|
|
|
19
|
|
1555
|
); |
|
|
19
|
|
|
|
|
1114
|
|
|
25
|
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
my $sep = qr/'|__|::|\\|\//; |
|
27
|
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
# BUILDERS |
|
29
|
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
sub build_arg { |
|
31
|
601
|
|
|
601
|
0
|
1399
|
my ($self, $data) = @_; |
|
32
|
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
return { |
|
34
|
601
|
|
|
|
|
2300
|
value => $data, |
|
35
|
|
|
|
|
|
|
}; |
|
36
|
|
|
|
|
|
|
} |
|
37
|
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
# METHODS |
|
39
|
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
sub assertion { |
|
41
|
0
|
|
|
0
|
1
|
0
|
my ($self) = @_; |
|
42
|
|
|
|
|
|
|
|
|
43
|
0
|
|
|
|
|
0
|
my $assert = $self->SUPER::assertion; |
|
44
|
|
|
|
|
|
|
|
|
45
|
0
|
|
|
|
|
0
|
$assert->clear->expression('string'); |
|
46
|
|
|
|
|
|
|
|
|
47
|
0
|
|
|
|
|
0
|
return $assert; |
|
48
|
|
|
|
|
|
|
} |
|
49
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
sub default { |
|
51
|
1
|
|
|
1
|
1
|
5
|
return 'Venus'; |
|
52
|
|
|
|
|
|
|
} |
|
53
|
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
sub dist { |
|
55
|
1
|
|
|
1
|
1
|
3
|
my ($self) = @_; |
|
56
|
|
|
|
|
|
|
|
|
57
|
1
|
|
|
|
|
9
|
return $self->label =~ s/_/-/gr; |
|
58
|
|
|
|
|
|
|
} |
|
59
|
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
sub explain { |
|
61
|
10
|
|
|
10
|
1
|
150
|
my ($self) = @_; |
|
62
|
|
|
|
|
|
|
|
|
63
|
10
|
|
|
|
|
30
|
return $self->get; |
|
64
|
|
|
|
|
|
|
} |
|
65
|
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
sub file { |
|
67
|
2
|
|
|
2
|
1
|
8
|
my ($self) = @_; |
|
68
|
|
|
|
|
|
|
|
|
69
|
2
|
50
|
|
|
|
6
|
return $self->get if $self->lookslike_a_file; |
|
70
|
|
|
|
|
|
|
|
|
71
|
2
|
|
|
|
|
8
|
my $string = $self->package; |
|
72
|
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
return join '__', map { |
|
74
|
2
|
|
|
|
|
11
|
join '_', map {lc} map {split /_/} grep {length} |
|
|
4
|
|
|
|
|
16
|
|
|
|
4
|
|
|
|
|
20
|
|
|
|
4
|
|
|
|
|
7
|
|
|
|
8
|
|
|
|
|
16
|
|
|
75
|
|
|
|
|
|
|
split /([A-Z]{1}[^A-Z]*)/ |
|
76
|
|
|
|
|
|
|
} split /$sep/, $string; |
|
77
|
|
|
|
|
|
|
} |
|
78
|
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
sub format { |
|
80
|
619
|
|
|
619
|
1
|
1515
|
my ($self, $method, $format) = @_; |
|
81
|
|
|
|
|
|
|
|
|
82
|
619
|
|
|
|
|
1137
|
local $_ = $self; |
|
83
|
|
|
|
|
|
|
|
|
84
|
619
|
|
|
|
|
1837
|
my $string = $self->$method; |
|
85
|
|
|
|
|
|
|
|
|
86
|
619
|
|
50
|
|
|
5514
|
return sprintf($format || '%s', $string); |
|
87
|
|
|
|
|
|
|
} |
|
88
|
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
sub label { |
|
90
|
103
|
|
|
103
|
1
|
194
|
my ($self) = @_; |
|
91
|
|
|
|
|
|
|
|
|
92
|
103
|
100
|
|
|
|
235
|
return $self->get if $self->lookslike_a_label; |
|
93
|
|
|
|
|
|
|
|
|
94
|
62
|
|
|
|
|
294
|
return join '_', split /$sep/, $self->package; |
|
95
|
|
|
|
|
|
|
} |
|
96
|
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
sub lookslike_a_file { |
|
98
|
3
|
|
|
3
|
1
|
8
|
my ($self) = @_; |
|
99
|
|
|
|
|
|
|
|
|
100
|
3
|
|
|
|
|
13
|
my $string = $self->get; |
|
101
|
|
|
|
|
|
|
|
|
102
|
3
|
|
|
|
|
24
|
return $string =~ /^[a-z](?:\w*[a-z])?$/; |
|
103
|
|
|
|
|
|
|
} |
|
104
|
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
sub lookslike_a_label { |
|
106
|
104
|
|
|
104
|
1
|
163
|
my ($self) = @_; |
|
107
|
|
|
|
|
|
|
|
|
108
|
104
|
|
|
|
|
219
|
my $string = $self->get; |
|
109
|
|
|
|
|
|
|
|
|
110
|
104
|
|
|
|
|
661
|
return $string =~ /^[A-Z](?:\w*[a-zA-Z0-9])?$/; |
|
111
|
|
|
|
|
|
|
} |
|
112
|
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
sub lookslike_a_package { |
|
114
|
2002
|
|
|
2002
|
1
|
3075
|
my ($self) = @_; |
|
115
|
|
|
|
|
|
|
|
|
116
|
2002
|
|
|
|
|
3967
|
my $string = $self->get; |
|
117
|
|
|
|
|
|
|
|
|
118
|
2002
|
|
|
|
|
14667
|
return $string =~ /^[A-Z](?:(?:\w|::)*[a-zA-Z0-9])?$/; |
|
119
|
|
|
|
|
|
|
} |
|
120
|
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
sub lookslike_a_path { |
|
122
|
687
|
|
|
687
|
1
|
1153
|
my ($self) = @_; |
|
123
|
|
|
|
|
|
|
|
|
124
|
687
|
|
|
|
|
1586
|
my $string = $self->get; |
|
125
|
|
|
|
|
|
|
|
|
126
|
687
|
|
|
|
|
5404
|
return $string =~ /^[A-Z](?:(?:\w|\\|\/|[\:\.]{1}[a-zA-Z0-9])*[a-zA-Z0-9])?$/; |
|
127
|
|
|
|
|
|
|
} |
|
128
|
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
sub lookslike_a_pragma { |
|
130
|
849
|
|
|
849
|
1
|
1630
|
my ($self) = @_; |
|
131
|
|
|
|
|
|
|
|
|
132
|
849
|
|
|
|
|
2020
|
my $string = $self->get; |
|
133
|
|
|
|
|
|
|
|
|
134
|
849
|
|
|
|
|
4514
|
return $string =~ /^\[\w+\]$/; |
|
135
|
|
|
|
|
|
|
} |
|
136
|
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
sub package { |
|
138
|
2001
|
|
|
2001
|
1
|
3633
|
my ($self) = @_; |
|
139
|
|
|
|
|
|
|
|
|
140
|
2001
|
100
|
|
|
|
4027
|
return $self->get if $self->lookslike_a_package; |
|
141
|
|
|
|
|
|
|
|
|
142
|
271
|
50
|
|
|
|
842
|
return substr($self->get, 1, -1) if $self->lookslike_a_pragma; |
|
143
|
|
|
|
|
|
|
|
|
144
|
271
|
|
|
|
|
774
|
my $string = $self->get; |
|
145
|
|
|
|
|
|
|
|
|
146
|
271
|
100
|
|
|
|
2421
|
if ($string !~ $sep) { |
|
147
|
34
|
|
|
|
|
222
|
return join '', map {ucfirst} split /[^a-zA-Z0-9]/, $string; |
|
|
47
|
|
|
|
|
254
|
|
|
148
|
|
|
|
|
|
|
} else { |
|
149
|
|
|
|
|
|
|
return join '::', map { |
|
150
|
237
|
|
|
|
|
1553
|
join '', map {ucfirst} split /[^a-zA-Z0-9]/ |
|
|
490
|
|
|
|
|
1351
|
|
|
|
493
|
|
|
|
|
2972
|
|
|
151
|
|
|
|
|
|
|
} split /$sep/, $string; |
|
152
|
|
|
|
|
|
|
} |
|
153
|
|
|
|
|
|
|
} |
|
154
|
|
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
sub path { |
|
156
|
686
|
|
|
686
|
1
|
1217
|
my ($self) = @_; |
|
157
|
|
|
|
|
|
|
|
|
158
|
686
|
100
|
|
|
|
1482
|
return $self->get if $self->lookslike_a_path; |
|
159
|
|
|
|
|
|
|
|
|
160
|
369
|
|
|
|
|
1903
|
return join '/', split /$sep/, $self->package; |
|
161
|
|
|
|
|
|
|
} |
|
162
|
|
|
|
|
|
|
|
|
163
|
|
|
|
|
|
|
1; |
|
164
|
|
|
|
|
|
|
|
|
165
|
|
|
|
|
|
|
|
|
166
|
|
|
|
|
|
|
|
|
167
|
|
|
|
|
|
|
=head1 NAME |
|
168
|
|
|
|
|
|
|
|
|
169
|
|
|
|
|
|
|
Venus::Name - Name Class |
|
170
|
|
|
|
|
|
|
|
|
171
|
|
|
|
|
|
|
=cut |
|
172
|
|
|
|
|
|
|
|
|
173
|
|
|
|
|
|
|
=head1 ABSTRACT |
|
174
|
|
|
|
|
|
|
|
|
175
|
|
|
|
|
|
|
Name Class for Perl 5 |
|
176
|
|
|
|
|
|
|
|
|
177
|
|
|
|
|
|
|
=cut |
|
178
|
|
|
|
|
|
|
|
|
179
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
180
|
|
|
|
|
|
|
|
|
181
|
|
|
|
|
|
|
package main; |
|
182
|
|
|
|
|
|
|
|
|
183
|
|
|
|
|
|
|
use Venus::Name; |
|
184
|
|
|
|
|
|
|
|
|
185
|
|
|
|
|
|
|
my $name = Venus::Name->new('Foo/Bar'); |
|
186
|
|
|
|
|
|
|
|
|
187
|
|
|
|
|
|
|
# $name->package; |
|
188
|
|
|
|
|
|
|
|
|
189
|
|
|
|
|
|
|
=cut |
|
190
|
|
|
|
|
|
|
|
|
191
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
192
|
|
|
|
|
|
|
|
|
193
|
|
|
|
|
|
|
This package provides methods for parsing and formatting package namespace |
|
194
|
|
|
|
|
|
|
strings. |
|
195
|
|
|
|
|
|
|
|
|
196
|
|
|
|
|
|
|
=cut |
|
197
|
|
|
|
|
|
|
|
|
198
|
|
|
|
|
|
|
=head1 INHERITS |
|
199
|
|
|
|
|
|
|
|
|
200
|
|
|
|
|
|
|
This package inherits behaviors from: |
|
201
|
|
|
|
|
|
|
|
|
202
|
|
|
|
|
|
|
L |
|
203
|
|
|
|
|
|
|
|
|
204
|
|
|
|
|
|
|
=cut |
|
205
|
|
|
|
|
|
|
|
|
206
|
|
|
|
|
|
|
=head1 INTEGRATES |
|
207
|
|
|
|
|
|
|
|
|
208
|
|
|
|
|
|
|
This package integrates behaviors from: |
|
209
|
|
|
|
|
|
|
|
|
210
|
|
|
|
|
|
|
L |
|
211
|
|
|
|
|
|
|
|
|
212
|
|
|
|
|
|
|
L |
|
213
|
|
|
|
|
|
|
|
|
214
|
|
|
|
|
|
|
L |
|
215
|
|
|
|
|
|
|
|
|
216
|
|
|
|
|
|
|
L |
|
217
|
|
|
|
|
|
|
|
|
218
|
|
|
|
|
|
|
=cut |
|
219
|
|
|
|
|
|
|
|
|
220
|
|
|
|
|
|
|
=head1 METHODS |
|
221
|
|
|
|
|
|
|
|
|
222
|
|
|
|
|
|
|
This package provides the following methods: |
|
223
|
|
|
|
|
|
|
|
|
224
|
|
|
|
|
|
|
=cut |
|
225
|
|
|
|
|
|
|
|
|
226
|
|
|
|
|
|
|
=head2 default |
|
227
|
|
|
|
|
|
|
|
|
228
|
|
|
|
|
|
|
default() (string) |
|
229
|
|
|
|
|
|
|
|
|
230
|
|
|
|
|
|
|
The default method returns the default value, i.e. C<'Venus'>. |
|
231
|
|
|
|
|
|
|
|
|
232
|
|
|
|
|
|
|
I> |
|
233
|
|
|
|
|
|
|
|
|
234
|
|
|
|
|
|
|
=over 4 |
|
235
|
|
|
|
|
|
|
|
|
236
|
|
|
|
|
|
|
=item default example 1 |
|
237
|
|
|
|
|
|
|
|
|
238
|
|
|
|
|
|
|
# given: synopsis; |
|
239
|
|
|
|
|
|
|
|
|
240
|
|
|
|
|
|
|
my $default = $name->default; |
|
241
|
|
|
|
|
|
|
|
|
242
|
|
|
|
|
|
|
# "Venus" |
|
243
|
|
|
|
|
|
|
|
|
244
|
|
|
|
|
|
|
=back |
|
245
|
|
|
|
|
|
|
|
|
246
|
|
|
|
|
|
|
=cut |
|
247
|
|
|
|
|
|
|
|
|
248
|
|
|
|
|
|
|
=head2 dist |
|
249
|
|
|
|
|
|
|
|
|
250
|
|
|
|
|
|
|
dist() (string) |
|
251
|
|
|
|
|
|
|
|
|
252
|
|
|
|
|
|
|
The dist method returns a package distribution representation of the name. |
|
253
|
|
|
|
|
|
|
|
|
254
|
|
|
|
|
|
|
I> |
|
255
|
|
|
|
|
|
|
|
|
256
|
|
|
|
|
|
|
=over 4 |
|
257
|
|
|
|
|
|
|
|
|
258
|
|
|
|
|
|
|
=item dist example 1 |
|
259
|
|
|
|
|
|
|
|
|
260
|
|
|
|
|
|
|
# given: synopsis; |
|
261
|
|
|
|
|
|
|
|
|
262
|
|
|
|
|
|
|
my $dist = $name->dist; |
|
263
|
|
|
|
|
|
|
|
|
264
|
|
|
|
|
|
|
# "Foo-Bar" |
|
265
|
|
|
|
|
|
|
|
|
266
|
|
|
|
|
|
|
=back |
|
267
|
|
|
|
|
|
|
|
|
268
|
|
|
|
|
|
|
=cut |
|
269
|
|
|
|
|
|
|
|
|
270
|
|
|
|
|
|
|
=head2 explain |
|
271
|
|
|
|
|
|
|
|
|
272
|
|
|
|
|
|
|
explain() (string) |
|
273
|
|
|
|
|
|
|
|
|
274
|
|
|
|
|
|
|
The explain method returns the package name and is used in stringification |
|
275
|
|
|
|
|
|
|
operations. |
|
276
|
|
|
|
|
|
|
|
|
277
|
|
|
|
|
|
|
I> |
|
278
|
|
|
|
|
|
|
|
|
279
|
|
|
|
|
|
|
=over 4 |
|
280
|
|
|
|
|
|
|
|
|
281
|
|
|
|
|
|
|
=item explain example 1 |
|
282
|
|
|
|
|
|
|
|
|
283
|
|
|
|
|
|
|
# given: synopsis; |
|
284
|
|
|
|
|
|
|
|
|
285
|
|
|
|
|
|
|
my $explain = $name->explain; |
|
286
|
|
|
|
|
|
|
|
|
287
|
|
|
|
|
|
|
# "Foo/Bar" |
|
288
|
|
|
|
|
|
|
|
|
289
|
|
|
|
|
|
|
=back |
|
290
|
|
|
|
|
|
|
|
|
291
|
|
|
|
|
|
|
=cut |
|
292
|
|
|
|
|
|
|
|
|
293
|
|
|
|
|
|
|
=head2 file |
|
294
|
|
|
|
|
|
|
|
|
295
|
|
|
|
|
|
|
file() (string) |
|
296
|
|
|
|
|
|
|
|
|
297
|
|
|
|
|
|
|
The file method returns a file representation of the name. |
|
298
|
|
|
|
|
|
|
|
|
299
|
|
|
|
|
|
|
I> |
|
300
|
|
|
|
|
|
|
|
|
301
|
|
|
|
|
|
|
=over 4 |
|
302
|
|
|
|
|
|
|
|
|
303
|
|
|
|
|
|
|
=item file example 1 |
|
304
|
|
|
|
|
|
|
|
|
305
|
|
|
|
|
|
|
# given: synopsis; |
|
306
|
|
|
|
|
|
|
|
|
307
|
|
|
|
|
|
|
my $file = $name->file; |
|
308
|
|
|
|
|
|
|
|
|
309
|
|
|
|
|
|
|
# "foo__bar" |
|
310
|
|
|
|
|
|
|
|
|
311
|
|
|
|
|
|
|
=back |
|
312
|
|
|
|
|
|
|
|
|
313
|
|
|
|
|
|
|
=cut |
|
314
|
|
|
|
|
|
|
|
|
315
|
|
|
|
|
|
|
=head2 format |
|
316
|
|
|
|
|
|
|
|
|
317
|
|
|
|
|
|
|
format(string $method, string $format) (string) |
|
318
|
|
|
|
|
|
|
|
|
319
|
|
|
|
|
|
|
The format method calls the specified method passing the result to the core |
|
320
|
|
|
|
|
|
|
L function with itself as an argument. This method supports |
|
321
|
|
|
|
|
|
|
dispatching, i.e. providing a method name and arguments whose return value will |
|
322
|
|
|
|
|
|
|
be acted on by this method. |
|
323
|
|
|
|
|
|
|
|
|
324
|
|
|
|
|
|
|
I> |
|
325
|
|
|
|
|
|
|
|
|
326
|
|
|
|
|
|
|
=over 4 |
|
327
|
|
|
|
|
|
|
|
|
328
|
|
|
|
|
|
|
=item format example 1 |
|
329
|
|
|
|
|
|
|
|
|
330
|
|
|
|
|
|
|
# given: synopsis; |
|
331
|
|
|
|
|
|
|
|
|
332
|
|
|
|
|
|
|
my $format = $name->format('file', '%s.t'); |
|
333
|
|
|
|
|
|
|
|
|
334
|
|
|
|
|
|
|
# "foo__bar.t" |
|
335
|
|
|
|
|
|
|
|
|
336
|
|
|
|
|
|
|
=back |
|
337
|
|
|
|
|
|
|
|
|
338
|
|
|
|
|
|
|
=cut |
|
339
|
|
|
|
|
|
|
|
|
340
|
|
|
|
|
|
|
=head2 label |
|
341
|
|
|
|
|
|
|
|
|
342
|
|
|
|
|
|
|
label() (string) |
|
343
|
|
|
|
|
|
|
|
|
344
|
|
|
|
|
|
|
The label method returns a label (or constant) representation of the name. |
|
345
|
|
|
|
|
|
|
|
|
346
|
|
|
|
|
|
|
I> |
|
347
|
|
|
|
|
|
|
|
|
348
|
|
|
|
|
|
|
=over 4 |
|
349
|
|
|
|
|
|
|
|
|
350
|
|
|
|
|
|
|
=item label example 1 |
|
351
|
|
|
|
|
|
|
|
|
352
|
|
|
|
|
|
|
# given: synopsis; |
|
353
|
|
|
|
|
|
|
|
|
354
|
|
|
|
|
|
|
my $label = $name->label; |
|
355
|
|
|
|
|
|
|
|
|
356
|
|
|
|
|
|
|
# "Foo_Bar" |
|
357
|
|
|
|
|
|
|
|
|
358
|
|
|
|
|
|
|
=back |
|
359
|
|
|
|
|
|
|
|
|
360
|
|
|
|
|
|
|
=cut |
|
361
|
|
|
|
|
|
|
|
|
362
|
|
|
|
|
|
|
=head2 lookslike_a_file |
|
363
|
|
|
|
|
|
|
|
|
364
|
|
|
|
|
|
|
lookslike_a_file() (string) |
|
365
|
|
|
|
|
|
|
|
|
366
|
|
|
|
|
|
|
The lookslike_a_file method returns truthy if its state resembles a filename. |
|
367
|
|
|
|
|
|
|
|
|
368
|
|
|
|
|
|
|
I> |
|
369
|
|
|
|
|
|
|
|
|
370
|
|
|
|
|
|
|
=over 4 |
|
371
|
|
|
|
|
|
|
|
|
372
|
|
|
|
|
|
|
=item lookslike_a_file example 1 |
|
373
|
|
|
|
|
|
|
|
|
374
|
|
|
|
|
|
|
# given: synopsis; |
|
375
|
|
|
|
|
|
|
|
|
376
|
|
|
|
|
|
|
my $lookslike_a_file = $name->lookslike_a_file; |
|
377
|
|
|
|
|
|
|
|
|
378
|
|
|
|
|
|
|
# "" |
|
379
|
|
|
|
|
|
|
|
|
380
|
|
|
|
|
|
|
=back |
|
381
|
|
|
|
|
|
|
|
|
382
|
|
|
|
|
|
|
=cut |
|
383
|
|
|
|
|
|
|
|
|
384
|
|
|
|
|
|
|
=head2 lookslike_a_label |
|
385
|
|
|
|
|
|
|
|
|
386
|
|
|
|
|
|
|
lookslike_a_label() (string) |
|
387
|
|
|
|
|
|
|
|
|
388
|
|
|
|
|
|
|
The lookslike_a_label method returns truthy if its state resembles a label (or |
|
389
|
|
|
|
|
|
|
constant). |
|
390
|
|
|
|
|
|
|
|
|
391
|
|
|
|
|
|
|
I> |
|
392
|
|
|
|
|
|
|
|
|
393
|
|
|
|
|
|
|
=over 4 |
|
394
|
|
|
|
|
|
|
|
|
395
|
|
|
|
|
|
|
=item lookslike_a_label example 1 |
|
396
|
|
|
|
|
|
|
|
|
397
|
|
|
|
|
|
|
# given: synopsis; |
|
398
|
|
|
|
|
|
|
|
|
399
|
|
|
|
|
|
|
my $lookslike_a_label = $name->lookslike_a_label; |
|
400
|
|
|
|
|
|
|
|
|
401
|
|
|
|
|
|
|
# "" |
|
402
|
|
|
|
|
|
|
|
|
403
|
|
|
|
|
|
|
=back |
|
404
|
|
|
|
|
|
|
|
|
405
|
|
|
|
|
|
|
=cut |
|
406
|
|
|
|
|
|
|
|
|
407
|
|
|
|
|
|
|
=head2 lookslike_a_package |
|
408
|
|
|
|
|
|
|
|
|
409
|
|
|
|
|
|
|
lookslike_a_package() (string) |
|
410
|
|
|
|
|
|
|
|
|
411
|
|
|
|
|
|
|
The lookslike_a_package method returns truthy if its state resembles a package |
|
412
|
|
|
|
|
|
|
name. |
|
413
|
|
|
|
|
|
|
|
|
414
|
|
|
|
|
|
|
I> |
|
415
|
|
|
|
|
|
|
|
|
416
|
|
|
|
|
|
|
=over 4 |
|
417
|
|
|
|
|
|
|
|
|
418
|
|
|
|
|
|
|
=item lookslike_a_package example 1 |
|
419
|
|
|
|
|
|
|
|
|
420
|
|
|
|
|
|
|
# given: synopsis; |
|
421
|
|
|
|
|
|
|
|
|
422
|
|
|
|
|
|
|
my $lookslike_a_package = $name->lookslike_a_package; |
|
423
|
|
|
|
|
|
|
|
|
424
|
|
|
|
|
|
|
# "" |
|
425
|
|
|
|
|
|
|
|
|
426
|
|
|
|
|
|
|
=back |
|
427
|
|
|
|
|
|
|
|
|
428
|
|
|
|
|
|
|
=cut |
|
429
|
|
|
|
|
|
|
|
|
430
|
|
|
|
|
|
|
=head2 lookslike_a_path |
|
431
|
|
|
|
|
|
|
|
|
432
|
|
|
|
|
|
|
lookslike_a_path() (string) |
|
433
|
|
|
|
|
|
|
|
|
434
|
|
|
|
|
|
|
The lookslike_a_path method returns truthy if its state resembles a file path. |
|
435
|
|
|
|
|
|
|
|
|
436
|
|
|
|
|
|
|
I> |
|
437
|
|
|
|
|
|
|
|
|
438
|
|
|
|
|
|
|
=over 4 |
|
439
|
|
|
|
|
|
|
|
|
440
|
|
|
|
|
|
|
=item lookslike_a_path example 1 |
|
441
|
|
|
|
|
|
|
|
|
442
|
|
|
|
|
|
|
# given: synopsis; |
|
443
|
|
|
|
|
|
|
|
|
444
|
|
|
|
|
|
|
my $lookslike_a_path = $name->lookslike_a_path; |
|
445
|
|
|
|
|
|
|
|
|
446
|
|
|
|
|
|
|
# 1 |
|
447
|
|
|
|
|
|
|
|
|
448
|
|
|
|
|
|
|
=back |
|
449
|
|
|
|
|
|
|
|
|
450
|
|
|
|
|
|
|
=cut |
|
451
|
|
|
|
|
|
|
|
|
452
|
|
|
|
|
|
|
=head2 lookslike_a_pragma |
|
453
|
|
|
|
|
|
|
|
|
454
|
|
|
|
|
|
|
lookslike_a_pragma() (string) |
|
455
|
|
|
|
|
|
|
|
|
456
|
|
|
|
|
|
|
The lookslike_a_pragma method returns truthy if its state resembles a pragma. |
|
457
|
|
|
|
|
|
|
|
|
458
|
|
|
|
|
|
|
I> |
|
459
|
|
|
|
|
|
|
|
|
460
|
|
|
|
|
|
|
=over 4 |
|
461
|
|
|
|
|
|
|
|
|
462
|
|
|
|
|
|
|
=item lookslike_a_pragma example 1 |
|
463
|
|
|
|
|
|
|
|
|
464
|
|
|
|
|
|
|
# given: synopsis; |
|
465
|
|
|
|
|
|
|
|
|
466
|
|
|
|
|
|
|
my $lookslike_a_pragma = $name->lookslike_a_pragma; |
|
467
|
|
|
|
|
|
|
|
|
468
|
|
|
|
|
|
|
# "" |
|
469
|
|
|
|
|
|
|
|
|
470
|
|
|
|
|
|
|
=back |
|
471
|
|
|
|
|
|
|
|
|
472
|
|
|
|
|
|
|
=cut |
|
473
|
|
|
|
|
|
|
|
|
474
|
|
|
|
|
|
|
=head2 package |
|
475
|
|
|
|
|
|
|
|
|
476
|
|
|
|
|
|
|
package() (string) |
|
477
|
|
|
|
|
|
|
|
|
478
|
|
|
|
|
|
|
The package method returns a package name representation of the name given. |
|
479
|
|
|
|
|
|
|
|
|
480
|
|
|
|
|
|
|
I> |
|
481
|
|
|
|
|
|
|
|
|
482
|
|
|
|
|
|
|
=over 4 |
|
483
|
|
|
|
|
|
|
|
|
484
|
|
|
|
|
|
|
=item package example 1 |
|
485
|
|
|
|
|
|
|
|
|
486
|
|
|
|
|
|
|
# given: synopsis; |
|
487
|
|
|
|
|
|
|
|
|
488
|
|
|
|
|
|
|
my $package = $name->package; |
|
489
|
|
|
|
|
|
|
|
|
490
|
|
|
|
|
|
|
# "Foo::Bar" |
|
491
|
|
|
|
|
|
|
|
|
492
|
|
|
|
|
|
|
=back |
|
493
|
|
|
|
|
|
|
|
|
494
|
|
|
|
|
|
|
=cut |
|
495
|
|
|
|
|
|
|
|
|
496
|
|
|
|
|
|
|
=head2 path |
|
497
|
|
|
|
|
|
|
|
|
498
|
|
|
|
|
|
|
path() (string) |
|
499
|
|
|
|
|
|
|
|
|
500
|
|
|
|
|
|
|
The path method returns a path representation of the name. |
|
501
|
|
|
|
|
|
|
|
|
502
|
|
|
|
|
|
|
I> |
|
503
|
|
|
|
|
|
|
|
|
504
|
|
|
|
|
|
|
=over 4 |
|
505
|
|
|
|
|
|
|
|
|
506
|
|
|
|
|
|
|
=item path example 1 |
|
507
|
|
|
|
|
|
|
|
|
508
|
|
|
|
|
|
|
# given: synopsis; |
|
509
|
|
|
|
|
|
|
|
|
510
|
|
|
|
|
|
|
my $path = $name->path; |
|
511
|
|
|
|
|
|
|
|
|
512
|
|
|
|
|
|
|
# "Foo/Bar" |
|
513
|
|
|
|
|
|
|
|
|
514
|
|
|
|
|
|
|
=back |
|
515
|
|
|
|
|
|
|
|
|
516
|
|
|
|
|
|
|
=cut |
|
517
|
|
|
|
|
|
|
|
|
518
|
|
|
|
|
|
|
=head1 OPERATORS |
|
519
|
|
|
|
|
|
|
|
|
520
|
|
|
|
|
|
|
This package overloads the following operators: |
|
521
|
|
|
|
|
|
|
|
|
522
|
|
|
|
|
|
|
=cut |
|
523
|
|
|
|
|
|
|
|
|
524
|
|
|
|
|
|
|
=over 4 |
|
525
|
|
|
|
|
|
|
|
|
526
|
|
|
|
|
|
|
=item operation: C<("")> |
|
527
|
|
|
|
|
|
|
|
|
528
|
|
|
|
|
|
|
This package overloads the C<""> operator. |
|
529
|
|
|
|
|
|
|
|
|
530
|
|
|
|
|
|
|
B |
|
531
|
|
|
|
|
|
|
|
|
532
|
|
|
|
|
|
|
# given: synopsis; |
|
533
|
|
|
|
|
|
|
|
|
534
|
|
|
|
|
|
|
my $result = "$name"; |
|
535
|
|
|
|
|
|
|
|
|
536
|
|
|
|
|
|
|
# "Foo/Bar" |
|
537
|
|
|
|
|
|
|
|
|
538
|
|
|
|
|
|
|
B |
|
539
|
|
|
|
|
|
|
|
|
540
|
|
|
|
|
|
|
# given: synopsis; |
|
541
|
|
|
|
|
|
|
|
|
542
|
|
|
|
|
|
|
my $result = "$name, $name"; |
|
543
|
|
|
|
|
|
|
|
|
544
|
|
|
|
|
|
|
# "Foo/Bar, Foo/Bar" |
|
545
|
|
|
|
|
|
|
|
|
546
|
|
|
|
|
|
|
=back |
|
547
|
|
|
|
|
|
|
|
|
548
|
|
|
|
|
|
|
=over 4 |
|
549
|
|
|
|
|
|
|
|
|
550
|
|
|
|
|
|
|
=item operation: C<(.)> |
|
551
|
|
|
|
|
|
|
|
|
552
|
|
|
|
|
|
|
This package overloads the C<.> operator. |
|
553
|
|
|
|
|
|
|
|
|
554
|
|
|
|
|
|
|
B |
|
555
|
|
|
|
|
|
|
|
|
556
|
|
|
|
|
|
|
# given: synopsis; |
|
557
|
|
|
|
|
|
|
|
|
558
|
|
|
|
|
|
|
my $package = $name . 'Baz'; |
|
559
|
|
|
|
|
|
|
|
|
560
|
|
|
|
|
|
|
# "Foo::BarBaz" |
|
561
|
|
|
|
|
|
|
|
|
562
|
|
|
|
|
|
|
=back |
|
563
|
|
|
|
|
|
|
|
|
564
|
|
|
|
|
|
|
=over 4 |
|
565
|
|
|
|
|
|
|
|
|
566
|
|
|
|
|
|
|
=item operation: C<(eq)> |
|
567
|
|
|
|
|
|
|
|
|
568
|
|
|
|
|
|
|
This package overloads the C operator. |
|
569
|
|
|
|
|
|
|
|
|
570
|
|
|
|
|
|
|
B |
|
571
|
|
|
|
|
|
|
|
|
572
|
|
|
|
|
|
|
# given: synopsis; |
|
573
|
|
|
|
|
|
|
|
|
574
|
|
|
|
|
|
|
$name eq 'Foo/Bar'; |
|
575
|
|
|
|
|
|
|
|
|
576
|
|
|
|
|
|
|
# 1 |
|
577
|
|
|
|
|
|
|
|
|
578
|
|
|
|
|
|
|
B |
|
579
|
|
|
|
|
|
|
|
|
580
|
|
|
|
|
|
|
package main; |
|
581
|
|
|
|
|
|
|
|
|
582
|
|
|
|
|
|
|
use Venus::Name; |
|
583
|
|
|
|
|
|
|
|
|
584
|
|
|
|
|
|
|
my $name1 = Venus::Name->new('Foo\Bar'); |
|
585
|
|
|
|
|
|
|
my $name2 = Venus::Name->new('Foo\Bar'); |
|
586
|
|
|
|
|
|
|
|
|
587
|
|
|
|
|
|
|
$name1 eq $name2; |
|
588
|
|
|
|
|
|
|
|
|
589
|
|
|
|
|
|
|
# 1 |
|
590
|
|
|
|
|
|
|
|
|
591
|
|
|
|
|
|
|
=back |
|
592
|
|
|
|
|
|
|
|
|
593
|
|
|
|
|
|
|
=over 4 |
|
594
|
|
|
|
|
|
|
|
|
595
|
|
|
|
|
|
|
=item operation: C<(ne)> |
|
596
|
|
|
|
|
|
|
|
|
597
|
|
|
|
|
|
|
This package overloads the C operator. |
|
598
|
|
|
|
|
|
|
|
|
599
|
|
|
|
|
|
|
B |
|
600
|
|
|
|
|
|
|
|
|
601
|
|
|
|
|
|
|
# given: synopsis; |
|
602
|
|
|
|
|
|
|
|
|
603
|
|
|
|
|
|
|
$name ne 'Foo\Bar'; |
|
604
|
|
|
|
|
|
|
|
|
605
|
|
|
|
|
|
|
# 1 |
|
606
|
|
|
|
|
|
|
|
|
607
|
|
|
|
|
|
|
B |
|
608
|
|
|
|
|
|
|
|
|
609
|
|
|
|
|
|
|
package main; |
|
610
|
|
|
|
|
|
|
|
|
611
|
|
|
|
|
|
|
use Venus::Name; |
|
612
|
|
|
|
|
|
|
|
|
613
|
|
|
|
|
|
|
my $name1 = Venus::Name->new('FooBar'); |
|
614
|
|
|
|
|
|
|
my $name2 = Venus::Name->new('Foo_Bar'); |
|
615
|
|
|
|
|
|
|
|
|
616
|
|
|
|
|
|
|
$name1 ne $name2; |
|
617
|
|
|
|
|
|
|
|
|
618
|
|
|
|
|
|
|
# 1 |
|
619
|
|
|
|
|
|
|
|
|
620
|
|
|
|
|
|
|
=back |
|
621
|
|
|
|
|
|
|
|
|
622
|
|
|
|
|
|
|
=over 4 |
|
623
|
|
|
|
|
|
|
|
|
624
|
|
|
|
|
|
|
=item operation: C<(qr)> |
|
625
|
|
|
|
|
|
|
|
|
626
|
|
|
|
|
|
|
This package overloads the C operator. |
|
627
|
|
|
|
|
|
|
|
|
628
|
|
|
|
|
|
|
B |
|
629
|
|
|
|
|
|
|
|
|
630
|
|
|
|
|
|
|
# given: synopsis; |
|
631
|
|
|
|
|
|
|
|
|
632
|
|
|
|
|
|
|
"Foo/Bar" =~ qr/$name/; |
|
633
|
|
|
|
|
|
|
|
|
634
|
|
|
|
|
|
|
# 1 |
|
635
|
|
|
|
|
|
|
|
|
636
|
|
|
|
|
|
|
=back |
|
637
|
|
|
|
|
|
|
|
|
638
|
|
|
|
|
|
|
=over 4 |
|
639
|
|
|
|
|
|
|
|
|
640
|
|
|
|
|
|
|
=item operation: C<(~~)> |
|
641
|
|
|
|
|
|
|
|
|
642
|
|
|
|
|
|
|
This package overloads the C<~~> operator. |
|
643
|
|
|
|
|
|
|
|
|
644
|
|
|
|
|
|
|
B |
|
645
|
|
|
|
|
|
|
|
|
646
|
|
|
|
|
|
|
# given: synopsis; |
|
647
|
|
|
|
|
|
|
|
|
648
|
|
|
|
|
|
|
my $result = $name ~~ 'Foo/Bar'; |
|
649
|
|
|
|
|
|
|
|
|
650
|
|
|
|
|
|
|
# 1 |
|
651
|
|
|
|
|
|
|
|
|
652
|
|
|
|
|
|
|
=back |
|
653
|
|
|
|
|
|
|
|
|
654
|
|
|
|
|
|
|
=head1 AUTHORS |
|
655
|
|
|
|
|
|
|
|
|
656
|
|
|
|
|
|
|
Awncorp, C |
|
657
|
|
|
|
|
|
|
|
|
658
|
|
|
|
|
|
|
=cut |
|
659
|
|
|
|
|
|
|
|
|
660
|
|
|
|
|
|
|
=head1 LICENSE |
|
661
|
|
|
|
|
|
|
|
|
662
|
|
|
|
|
|
|
Copyright (C) 2000, Awncorp, C. |
|
663
|
|
|
|
|
|
|
|
|
664
|
|
|
|
|
|
|
This program is free software, you can redistribute it and/or modify it under |
|
665
|
|
|
|
|
|
|
the terms of the Apache license version 2.0. |
|
666
|
|
|
|
|
|
|
|
|
667
|
|
|
|
|
|
|
=cut |