line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Venus::Path; |
2
|
|
|
|
|
|
|
|
3
|
86
|
|
|
86
|
|
2121
|
use 5.018; |
|
86
|
|
|
|
|
324
|
|
4
|
|
|
|
|
|
|
|
5
|
86
|
|
|
86
|
|
469
|
use strict; |
|
86
|
|
|
|
|
178
|
|
|
86
|
|
|
|
|
1785
|
|
6
|
86
|
|
|
86
|
|
384
|
use warnings; |
|
86
|
|
|
|
|
139
|
|
|
86
|
|
|
|
|
2362
|
|
7
|
|
|
|
|
|
|
|
8
|
86
|
|
|
86
|
|
409
|
use Venus::Class 'base', 'with'; |
|
86
|
|
|
|
|
157
|
|
|
86
|
|
|
|
|
467
|
|
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
|
1
|
|
|
1
|
|
4
|
'eq' => sub{$_[0]->value eq "$_[1]"}, |
20
|
1
|
|
|
1
|
|
5
|
'ne' => sub{$_[0]->value ne "$_[1]"}, |
21
|
1
|
|
|
1
|
|
2
|
'qr' => sub{qr/@{[quotemeta($_[0]->value)]}/}, |
|
1
|
|
|
|
|
5
|
|
22
|
86
|
|
|
|
|
1033
|
'~~' => 'explain', |
23
|
|
|
|
|
|
|
fallback => 1, |
24
|
86
|
|
|
86
|
|
631
|
); |
|
86
|
|
|
|
|
173
|
|
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
# HOOKS |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
sub _exitcode { |
29
|
6
|
|
|
6
|
|
685
|
$? >> 8; |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
# METHODS |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
sub assertion { |
35
|
4
|
|
|
4
|
1
|
9
|
my ($self) = @_; |
36
|
|
|
|
|
|
|
|
37
|
4
|
|
|
|
|
36
|
my $assert = $self->SUPER::assertion; |
38
|
|
|
|
|
|
|
|
39
|
4
|
|
|
|
|
18
|
$assert->clear->expression('string'); |
40
|
|
|
|
|
|
|
|
41
|
4
|
|
|
|
|
21
|
return $assert; |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
sub absolute { |
45
|
73
|
|
|
73
|
1
|
145
|
my ($self) = @_; |
46
|
|
|
|
|
|
|
|
47
|
73
|
|
|
|
|
257
|
require File::Spec; |
48
|
|
|
|
|
|
|
|
49
|
73
|
|
|
|
|
339
|
return $self->class->new(File::Spec->rel2abs($self->get)); |
50
|
|
|
|
|
|
|
} |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
sub basename { |
53
|
5
|
|
|
5
|
1
|
11
|
my ($self) = @_; |
54
|
|
|
|
|
|
|
|
55
|
5
|
|
|
|
|
30
|
require File::Basename; |
56
|
|
|
|
|
|
|
|
57
|
5
|
|
|
|
|
19
|
return File::Basename::basename($self->get); |
58
|
|
|
|
|
|
|
} |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
sub child { |
61
|
51
|
|
|
51
|
1
|
146
|
my ($self, $path) = @_; |
62
|
|
|
|
|
|
|
|
63
|
51
|
|
|
|
|
234
|
require File::Spec; |
64
|
|
|
|
|
|
|
|
65
|
51
|
|
|
|
|
388
|
my @parts = File::Spec->splitdir($path); |
66
|
|
|
|
|
|
|
|
67
|
51
|
|
|
|
|
195
|
return $self->class->new(File::Spec->catfile($self->get, @parts)); |
68
|
|
|
|
|
|
|
} |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
sub chmod { |
71
|
1
|
|
|
1
|
1
|
4
|
my ($self, $mode) = @_; |
72
|
|
|
|
|
|
|
|
73
|
1
|
|
|
|
|
3
|
my $path = $self->get; |
74
|
|
|
|
|
|
|
|
75
|
1
|
|
|
|
|
77
|
CORE::chmod($mode, $path); |
76
|
|
|
|
|
|
|
|
77
|
1
|
|
|
|
|
16
|
return $self; |
78
|
|
|
|
|
|
|
} |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
sub chown { |
81
|
1
|
|
|
1
|
1
|
6
|
my ($self, @args) = @_; |
82
|
|
|
|
|
|
|
|
83
|
1
|
|
|
|
|
6
|
my $path = $self->get; |
84
|
|
|
|
|
|
|
|
85
|
1
|
|
50
|
|
|
56
|
CORE::chown((map $_||-1, @args[0,1]), $path); |
86
|
|
|
|
|
|
|
|
87
|
1
|
|
|
|
|
17
|
return $self; |
88
|
|
|
|
|
|
|
} |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
sub children { |
91
|
28
|
|
|
28
|
1
|
76
|
my ($self) = @_; |
92
|
|
|
|
|
|
|
|
93
|
28
|
|
|
|
|
156
|
require File::Spec; |
94
|
|
|
|
|
|
|
|
95
|
28
|
|
|
|
|
143
|
my @paths = map $self->glob($_), '.??*', '*'; |
96
|
|
|
|
|
|
|
|
97
|
28
|
100
|
|
|
|
192
|
return wantarray ? (@paths) : \@paths; |
98
|
|
|
|
|
|
|
} |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
sub copy { |
101
|
1
|
|
|
1
|
1
|
3
|
my ($self, $path) = @_; |
102
|
|
|
|
|
|
|
|
103
|
1
|
|
|
|
|
665
|
require File::Copy; |
104
|
|
|
|
|
|
|
|
105
|
1
|
50
|
|
|
|
2304
|
File::Copy::copy("$self", "$path") |
106
|
|
|
|
|
|
|
or $self->throw('error_on_copy', $path, $!)->error; |
107
|
|
|
|
|
|
|
|
108
|
1
|
|
|
|
|
491
|
return $self; |
109
|
|
|
|
|
|
|
} |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
sub default { |
112
|
4
|
|
|
4
|
1
|
21
|
require Cwd; |
113
|
|
|
|
|
|
|
|
114
|
4
|
|
|
|
|
75
|
return Cwd::getcwd(); |
115
|
|
|
|
|
|
|
} |
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
sub directories { |
118
|
20
|
|
|
20
|
1
|
67
|
my ($self) = @_; |
119
|
|
|
|
|
|
|
|
120
|
20
|
|
|
|
|
64
|
my @paths = grep -d, $self->children; |
121
|
|
|
|
|
|
|
|
122
|
20
|
100
|
|
|
|
101
|
return wantarray ? (@paths) : \@paths; |
123
|
|
|
|
|
|
|
} |
124
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
sub exists { |
126
|
28
|
|
|
28
|
1
|
67
|
my ($self) = @_; |
127
|
|
|
|
|
|
|
|
128
|
28
|
|
|
|
|
88
|
return int!!-e $self->get; |
129
|
|
|
|
|
|
|
} |
130
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
sub explain { |
132
|
14713
|
|
|
14713
|
1
|
55956
|
my ($self) = @_; |
133
|
|
|
|
|
|
|
|
134
|
14713
|
|
|
|
|
39041
|
return $self->get; |
135
|
|
|
|
|
|
|
} |
136
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
sub extension { |
138
|
4
|
|
|
4
|
1
|
9
|
my ($self, $name) = @_; |
139
|
|
|
|
|
|
|
|
140
|
4
|
|
|
|
|
15
|
my $basename = $self->basename; |
141
|
|
|
|
|
|
|
|
142
|
4
|
100
|
100
|
|
|
35
|
return ($basename =~ /\.?.+\.([^\.]+)$/)[0] || undef if !$name; |
143
|
|
|
|
|
|
|
|
144
|
2
|
|
|
|
|
12
|
return $self->sibling(join '.', $basename, $name); |
145
|
|
|
|
|
|
|
} |
146
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
sub find { |
148
|
3
|
|
|
3
|
1
|
12
|
my ($self, $expr) = @_; |
149
|
|
|
|
|
|
|
|
150
|
3
|
100
|
|
|
|
9
|
$expr = '.*' if !$expr; |
151
|
|
|
|
|
|
|
|
152
|
3
|
50
|
|
|
|
61
|
$expr = qr/$expr/ if ref($expr) ne 'Regexp'; |
153
|
|
|
|
|
|
|
|
154
|
3
|
|
|
|
|
8
|
my @paths; |
155
|
|
|
|
|
|
|
|
156
|
|
|
|
|
|
|
push @paths, grep { |
157
|
42
|
|
|
|
|
125
|
$_ =~ $expr |
158
|
|
|
|
|
|
|
} map { |
159
|
3
|
50
|
|
|
|
20
|
$_->is_directory ? $_->find($expr) : $_ |
|
42
|
|
|
|
|
148
|
|
160
|
|
|
|
|
|
|
} |
161
|
|
|
|
|
|
|
$self->children; |
162
|
|
|
|
|
|
|
|
163
|
3
|
50
|
|
|
|
18
|
return wantarray ? (@paths) : \@paths; |
164
|
|
|
|
|
|
|
} |
165
|
|
|
|
|
|
|
|
166
|
|
|
|
|
|
|
sub files { |
167
|
1
|
|
|
1
|
1
|
4
|
my ($self) = @_; |
168
|
|
|
|
|
|
|
|
169
|
1
|
|
|
|
|
5
|
my @paths = grep -f, $self->children; |
170
|
|
|
|
|
|
|
|
171
|
1
|
50
|
|
|
|
10
|
return wantarray ? (@paths) : \@paths; |
172
|
|
|
|
|
|
|
} |
173
|
|
|
|
|
|
|
|
174
|
|
|
|
|
|
|
sub glob { |
175
|
59
|
|
|
59
|
1
|
171
|
my ($self, $expr) = @_; |
176
|
|
|
|
|
|
|
|
177
|
59
|
|
|
|
|
215
|
require File::Spec; |
178
|
|
|
|
|
|
|
|
179
|
59
|
|
100
|
|
|
172
|
$expr ||= '*'; |
180
|
|
|
|
|
|
|
|
181
|
59
|
|
|
|
|
168
|
my @paths = map $self->class->new($_), |
182
|
|
|
|
|
|
|
CORE::glob +File::Spec->catfile($self->absolute, $expr); |
183
|
|
|
|
|
|
|
|
184
|
59
|
100
|
|
|
|
397
|
return wantarray ? (@paths) : \@paths; |
185
|
|
|
|
|
|
|
} |
186
|
|
|
|
|
|
|
|
187
|
|
|
|
|
|
|
sub is_absolute { |
188
|
4
|
|
|
4
|
1
|
21
|
my ($self) = @_; |
189
|
|
|
|
|
|
|
|
190
|
4
|
|
|
|
|
25
|
require File::Spec; |
191
|
|
|
|
|
|
|
|
192
|
4
|
|
|
|
|
23
|
return int!!(File::Spec->file_name_is_absolute($self->get)); |
193
|
|
|
|
|
|
|
} |
194
|
|
|
|
|
|
|
|
195
|
|
|
|
|
|
|
sub is_directory { |
196
|
43
|
|
|
43
|
1
|
76
|
my ($self) = @_; |
197
|
|
|
|
|
|
|
|
198
|
43
|
|
|
|
|
106
|
my $path = $self->get; |
199
|
|
|
|
|
|
|
|
200
|
43
|
|
66
|
|
|
1111
|
return int!!(-e $path && -d $path); |
201
|
|
|
|
|
|
|
} |
202
|
|
|
|
|
|
|
|
203
|
|
|
|
|
|
|
sub is_file { |
204
|
11
|
|
|
11
|
1
|
38
|
my ($self) = @_; |
205
|
|
|
|
|
|
|
|
206
|
11
|
|
|
|
|
48
|
my $path = $self->get; |
207
|
|
|
|
|
|
|
|
208
|
11
|
|
100
|
|
|
387
|
return int!!(-e $path && !-d $path); |
209
|
|
|
|
|
|
|
} |
210
|
|
|
|
|
|
|
|
211
|
|
|
|
|
|
|
sub is_relative { |
212
|
3
|
|
|
3
|
1
|
9
|
my ($self) = @_; |
213
|
|
|
|
|
|
|
|
214
|
3
|
|
|
|
|
14
|
return int!$self->is_absolute; |
215
|
|
|
|
|
|
|
} |
216
|
|
|
|
|
|
|
|
217
|
|
|
|
|
|
|
sub lines { |
218
|
2
|
|
|
2
|
1
|
8
|
my ($self, $separator, $binmode) = @_; |
219
|
|
|
|
|
|
|
|
220
|
2
|
|
100
|
|
|
11
|
$separator //= "\n"; |
221
|
|
|
|
|
|
|
|
222
|
2
|
50
|
|
|
|
40
|
return [split /$separator/, $binmode ? $self->read($binmode) : $self->read]; |
223
|
|
|
|
|
|
|
} |
224
|
|
|
|
|
|
|
|
225
|
|
|
|
|
|
|
sub lineage { |
226
|
8
|
|
|
8
|
1
|
34
|
my ($self) = @_; |
227
|
|
|
|
|
|
|
|
228
|
8
|
|
|
|
|
45
|
require File::Spec; |
229
|
|
|
|
|
|
|
|
230
|
8
|
|
|
|
|
40
|
my @parts = File::Spec->splitdir($self->get); |
231
|
|
|
|
|
|
|
|
232
|
8
|
|
|
|
|
86
|
my @paths = (( |
233
|
|
|
|
|
|
|
reverse map $self->class->new(File::Spec->catfile(@parts[0..$_])), 1..$#parts |
234
|
|
|
|
|
|
|
), $self->class->new($parts[0])); |
235
|
|
|
|
|
|
|
|
236
|
8
|
100
|
|
|
|
111
|
return wantarray ? (@paths) : \@paths; |
237
|
|
|
|
|
|
|
} |
238
|
|
|
|
|
|
|
|
239
|
|
|
|
|
|
|
sub open { |
240
|
12
|
|
|
12
|
1
|
52
|
my ($self, @args) = @_; |
241
|
|
|
|
|
|
|
|
242
|
12
|
|
|
|
|
42
|
my $path = $self->get; |
243
|
|
|
|
|
|
|
|
244
|
12
|
|
|
|
|
86
|
require IO::File; |
245
|
|
|
|
|
|
|
|
246
|
12
|
|
|
|
|
95
|
my $handle = IO::File->new; |
247
|
|
|
|
|
|
|
|
248
|
12
|
100
|
|
|
|
598
|
$handle->open($path, @args) |
249
|
|
|
|
|
|
|
or $self->throw('error_on_open', $path, $!)->error; |
250
|
|
|
|
|
|
|
|
251
|
10
|
|
|
|
|
1187
|
return $handle; |
252
|
|
|
|
|
|
|
} |
253
|
|
|
|
|
|
|
|
254
|
|
|
|
|
|
|
sub mkcall { |
255
|
7
|
|
|
7
|
1
|
32
|
my ($self, @args) = @_; |
256
|
|
|
|
|
|
|
|
257
|
7
|
|
|
|
|
39
|
require File::Spec; |
258
|
|
|
|
|
|
|
|
259
|
7
|
|
|
|
|
36
|
my $path = File::Spec->catfile(File::Spec->splitdir($self->get)); |
260
|
|
|
|
|
|
|
|
261
|
7
|
|
|
|
|
25
|
my $result; |
262
|
|
|
|
|
|
|
|
263
|
7
|
|
|
|
|
28
|
require Venus::Os; |
264
|
|
|
|
|
|
|
|
265
|
7
|
|
|
|
|
59
|
my $args = join ' ', map Venus::Os->quote($_), grep defined, @args; |
266
|
|
|
|
|
|
|
|
267
|
7
|
100
|
|
|
|
74412
|
(defined($result = ($args ? qx($path $args) : qx($path)))) |
|
|
100
|
|
|
|
|
|
268
|
|
|
|
|
|
|
or $self->throw('error_on_mkcall', $path, $!)->error; |
269
|
|
|
|
|
|
|
|
270
|
6
|
|
|
|
|
133
|
chomp $result; |
271
|
|
|
|
|
|
|
|
272
|
6
|
100
|
|
|
|
346
|
return wantarray ? ($result, _exitcode()) : $result; |
273
|
|
|
|
|
|
|
} |
274
|
|
|
|
|
|
|
|
275
|
|
|
|
|
|
|
sub mkdir { |
276
|
10
|
|
|
10
|
1
|
29
|
my ($self, $mode) = @_; |
277
|
|
|
|
|
|
|
|
278
|
10
|
|
|
|
|
45
|
my $path = $self->get; |
279
|
|
|
|
|
|
|
|
280
|
10
|
50
|
|
|
|
835
|
($mode ? CORE::mkdir($path, $mode) : CORE::mkdir($path)) |
|
|
100
|
|
|
|
|
|
281
|
|
|
|
|
|
|
or $self->throw('error_on_mkdir', $path, $!)->error; |
282
|
|
|
|
|
|
|
|
283
|
8
|
|
|
|
|
96
|
return $self; |
284
|
|
|
|
|
|
|
} |
285
|
|
|
|
|
|
|
|
286
|
|
|
|
|
|
|
sub mkdirs { |
287
|
4
|
|
|
4
|
1
|
16
|
my ($self, $mode) = @_; |
288
|
|
|
|
|
|
|
|
289
|
4
|
|
|
|
|
17
|
my @paths; |
290
|
|
|
|
|
|
|
|
291
|
4
|
50
|
|
|
|
21
|
for my $path ( |
292
|
|
|
|
|
|
|
grep !!$_, reverse($self->parents), ($self->is_file ? () : $self) |
293
|
|
|
|
|
|
|
) |
294
|
|
|
|
|
|
|
{ |
295
|
12
|
100
|
|
|
|
54
|
if ($path->exists) { |
296
|
7
|
|
|
|
|
59
|
next; |
297
|
|
|
|
|
|
|
} |
298
|
|
|
|
|
|
|
else { |
299
|
5
|
|
|
|
|
53
|
push @paths, $path->mkdir($mode); |
300
|
|
|
|
|
|
|
} |
301
|
|
|
|
|
|
|
} |
302
|
|
|
|
|
|
|
|
303
|
4
|
50
|
|
|
|
30
|
return wantarray ? (@paths) : \@paths; |
304
|
|
|
|
|
|
|
} |
305
|
|
|
|
|
|
|
|
306
|
|
|
|
|
|
|
sub mktemp_dir { |
307
|
1
|
|
|
1
|
1
|
4
|
my ($self) = @_; |
308
|
|
|
|
|
|
|
|
309
|
1
|
|
|
|
|
1035
|
require File::Temp; |
310
|
|
|
|
|
|
|
|
311
|
1
|
|
|
|
|
10480
|
return $self->class->new(File::Temp::tempdir()); |
312
|
|
|
|
|
|
|
} |
313
|
|
|
|
|
|
|
|
314
|
|
|
|
|
|
|
sub mktemp_file { |
315
|
1
|
|
|
1
|
1
|
4
|
my ($self) = @_; |
316
|
|
|
|
|
|
|
|
317
|
1
|
|
|
|
|
5
|
require File::Temp; |
318
|
|
|
|
|
|
|
|
319
|
1
|
|
|
|
|
5
|
return $self->class->new((File::Temp::tempfile())[1]); |
320
|
|
|
|
|
|
|
} |
321
|
|
|
|
|
|
|
|
322
|
|
|
|
|
|
|
sub mkfile { |
323
|
9
|
|
|
9
|
1
|
26
|
my ($self) = @_; |
324
|
|
|
|
|
|
|
|
325
|
9
|
|
|
|
|
31
|
my $path = $self->get; |
326
|
|
|
|
|
|
|
|
327
|
9
|
100
|
|
|
|
36
|
return $self if $self->exists; |
328
|
|
|
|
|
|
|
|
329
|
8
|
|
|
|
|
48
|
$self->open('>'); |
330
|
|
|
|
|
|
|
|
331
|
7
|
50
|
|
|
|
147
|
CORE::utime(undef, undef, $path) |
332
|
|
|
|
|
|
|
or $self->throw('error_on_mkfile', $path, $!)->error; |
333
|
|
|
|
|
|
|
|
334
|
7
|
|
|
|
|
179
|
return $self; |
335
|
|
|
|
|
|
|
} |
336
|
|
|
|
|
|
|
|
337
|
|
|
|
|
|
|
sub move { |
338
|
3
|
|
|
3
|
1
|
10
|
my ($self, $path) = @_; |
339
|
|
|
|
|
|
|
|
340
|
3
|
|
|
|
|
14
|
require File::Copy; |
341
|
|
|
|
|
|
|
|
342
|
3
|
50
|
|
|
|
10
|
File::Copy::move("$self", "$path") |
343
|
|
|
|
|
|
|
or $self->throw('error_on_move', $path, $!)->error; |
344
|
|
|
|
|
|
|
|
345
|
3
|
|
|
|
|
418
|
return $self->class->make($path)->absolute; |
346
|
|
|
|
|
|
|
} |
347
|
|
|
|
|
|
|
|
348
|
|
|
|
|
|
|
sub name { |
349
|
1
|
|
|
1
|
1
|
5
|
my ($self) = @_; |
350
|
|
|
|
|
|
|
|
351
|
1
|
|
|
|
|
3
|
return $self->absolute->get; |
352
|
|
|
|
|
|
|
} |
353
|
|
|
|
|
|
|
|
354
|
|
|
|
|
|
|
sub parent { |
355
|
7
|
|
|
7
|
1
|
28
|
my ($self) = @_; |
356
|
|
|
|
|
|
|
|
357
|
7
|
|
|
|
|
47
|
require File::Spec; |
358
|
|
|
|
|
|
|
|
359
|
7
|
|
|
|
|
34
|
my @parts = File::Spec->splitdir($self->get); |
360
|
|
|
|
|
|
|
|
361
|
7
|
|
|
|
|
90
|
my $path = File::Spec->catfile(@parts[0..$#parts-1]); |
362
|
|
|
|
|
|
|
|
363
|
7
|
50
|
|
|
|
49
|
return defined $path ? $self->class->new($path) : undef; |
364
|
|
|
|
|
|
|
} |
365
|
|
|
|
|
|
|
|
366
|
|
|
|
|
|
|
sub parents { |
367
|
5
|
|
|
5
|
1
|
13
|
my ($self) = @_; |
368
|
|
|
|
|
|
|
|
369
|
5
|
|
|
|
|
26
|
my @paths = $self->lineage; |
370
|
|
|
|
|
|
|
|
371
|
5
|
50
|
|
|
|
60
|
@paths = @paths[1..$#paths] if @paths; |
372
|
|
|
|
|
|
|
|
373
|
5
|
100
|
|
|
|
352
|
return wantarray ? (@paths) : \@paths; |
374
|
|
|
|
|
|
|
} |
375
|
|
|
|
|
|
|
|
376
|
|
|
|
|
|
|
sub parts { |
377
|
1
|
|
|
1
|
1
|
4
|
my ($self) = @_; |
378
|
|
|
|
|
|
|
|
379
|
1
|
|
|
|
|
5
|
require File::Spec; |
380
|
|
|
|
|
|
|
|
381
|
1
|
|
|
|
|
6
|
return [File::Spec->splitdir($self->get)]; |
382
|
|
|
|
|
|
|
} |
383
|
|
|
|
|
|
|
|
384
|
|
|
|
|
|
|
sub read { |
385
|
7195
|
|
|
7195
|
1
|
15338
|
my ($self, $binmode) = @_; |
386
|
|
|
|
|
|
|
|
387
|
7195
|
|
|
|
|
16907
|
my $path = $self->get; |
388
|
|
|
|
|
|
|
|
389
|
7195
|
100
|
|
|
|
372563
|
CORE::open(my $handle, '<', $path) |
390
|
|
|
|
|
|
|
or $self->throw('error_on_read_open', $path, $!)->error; |
391
|
|
|
|
|
|
|
|
392
|
7194
|
50
|
0
|
|
|
32620
|
CORE::binmode($handle, $binmode) or do { |
393
|
0
|
|
|
|
|
0
|
$self->throw('error_on_read_binmode', $path, $binmode, $!)->error; |
394
|
|
|
|
|
|
|
} if defined($binmode); |
395
|
|
|
|
|
|
|
|
396
|
7194
|
|
|
|
|
17260
|
my $result = my $content = ''; |
397
|
|
|
|
|
|
|
|
398
|
7194
|
|
|
|
|
41754
|
while ($result = $handle->sysread(my $buffer, 131072, 0)) { |
399
|
7194
|
|
|
|
|
1569588
|
$content .= $buffer; |
400
|
|
|
|
|
|
|
} |
401
|
|
|
|
|
|
|
|
402
|
7194
|
50
|
|
|
|
133753
|
$self->throw('error_on_read_error', $path, $!)->error if !defined $result; |
403
|
|
|
|
|
|
|
|
404
|
7194
|
|
|
|
|
97713
|
require Venus::Os; |
405
|
7194
|
100
|
|
|
|
48621
|
$content =~ s/\015\012/\012/g if Venus::Os->is_win; |
406
|
|
|
|
|
|
|
|
407
|
7194
|
|
|
|
|
156290
|
return $content; |
408
|
|
|
|
|
|
|
} |
409
|
|
|
|
|
|
|
|
410
|
|
|
|
|
|
|
sub relative { |
411
|
2
|
|
|
2
|
1
|
9
|
my ($self, $path) = @_; |
412
|
|
|
|
|
|
|
|
413
|
2
|
|
|
|
|
11
|
require File::Spec; |
414
|
|
|
|
|
|
|
|
415
|
2
|
|
33
|
|
|
7
|
$path ||= $self->default; |
416
|
|
|
|
|
|
|
|
417
|
2
|
|
|
|
|
17
|
return $self->class->new(File::Spec->abs2rel($self->get, $path)); |
418
|
|
|
|
|
|
|
} |
419
|
|
|
|
|
|
|
|
420
|
|
|
|
|
|
|
sub rename { |
421
|
2
|
|
|
2
|
1
|
7
|
my ($self, $path) = @_; |
422
|
|
|
|
|
|
|
|
423
|
2
|
|
|
|
|
8
|
$path = $self->class->make($path); |
424
|
|
|
|
|
|
|
|
425
|
2
|
50
|
|
|
|
12
|
$path = $self->sibling("$path") if $path->is_relative; |
426
|
|
|
|
|
|
|
|
427
|
2
|
|
|
|
|
7
|
return $self->move($path); |
428
|
|
|
|
|
|
|
} |
429
|
|
|
|
|
|
|
|
430
|
|
|
|
|
|
|
sub rmdir { |
431
|
4
|
|
|
4
|
1
|
12
|
my ($self) = @_; |
432
|
|
|
|
|
|
|
|
433
|
4
|
|
|
|
|
16
|
my $path = $self->get; |
434
|
|
|
|
|
|
|
|
435
|
4
|
50
|
|
|
|
216
|
CORE::rmdir($path) |
436
|
|
|
|
|
|
|
or $self->throw('error_on_rmdir', $path, $!)->error; |
437
|
|
|
|
|
|
|
|
438
|
4
|
|
|
|
|
37
|
return $self; |
439
|
|
|
|
|
|
|
} |
440
|
|
|
|
|
|
|
|
441
|
|
|
|
|
|
|
sub rmdirs { |
442
|
2
|
|
|
2
|
1
|
4
|
my ($self) = @_; |
443
|
|
|
|
|
|
|
|
444
|
2
|
|
|
|
|
3
|
my @paths; |
445
|
|
|
|
|
|
|
|
446
|
2
|
|
|
|
|
15
|
for my $path ($self->children) { |
447
|
1
|
50
|
|
|
|
7
|
if ($path->is_file) { |
448
|
0
|
|
|
|
|
0
|
push @paths, $path->unlink; |
449
|
|
|
|
|
|
|
} |
450
|
|
|
|
|
|
|
else { |
451
|
1
|
|
|
|
|
8
|
push @paths, $path->rmdirs; |
452
|
|
|
|
|
|
|
} |
453
|
|
|
|
|
|
|
} |
454
|
|
|
|
|
|
|
|
455
|
2
|
|
|
|
|
8
|
push @paths, $self->rmdir; |
456
|
|
|
|
|
|
|
|
457
|
2
|
100
|
|
|
|
24
|
return wantarray ? (@paths) : \@paths; |
458
|
|
|
|
|
|
|
} |
459
|
|
|
|
|
|
|
|
460
|
|
|
|
|
|
|
sub rmfiles { |
461
|
1
|
|
|
1
|
1
|
8
|
my ($self) = @_; |
462
|
|
|
|
|
|
|
|
463
|
1
|
|
|
|
|
2
|
my @paths; |
464
|
|
|
|
|
|
|
|
465
|
1
|
|
|
|
|
5
|
for my $path ($self->children) { |
466
|
5
|
50
|
|
|
|
25
|
if ($path->is_file) { |
467
|
5
|
|
|
|
|
24
|
push @paths, $path->unlink; |
468
|
|
|
|
|
|
|
} |
469
|
|
|
|
|
|
|
else { |
470
|
0
|
|
|
|
|
0
|
push @paths, $path->rmfiles; |
471
|
|
|
|
|
|
|
} |
472
|
|
|
|
|
|
|
} |
473
|
|
|
|
|
|
|
|
474
|
1
|
50
|
|
|
|
18
|
return wantarray ? (@paths) : \@paths; |
475
|
|
|
|
|
|
|
} |
476
|
|
|
|
|
|
|
|
477
|
|
|
|
|
|
|
sub root { |
478
|
2
|
|
|
2
|
1
|
8
|
my ($self, $spec, $base) = @_; |
479
|
|
|
|
|
|
|
|
480
|
2
|
|
|
|
|
4
|
my @paths; |
481
|
|
|
|
|
|
|
|
482
|
2
|
|
|
|
|
12
|
for my $path ($self->absolute->lineage) { |
483
|
12
|
100
|
|
|
|
39
|
if ($path->child($base)->test($spec)) { |
484
|
1
|
|
|
|
|
5
|
push @paths, $path; |
485
|
1
|
|
|
|
|
6
|
last; |
486
|
|
|
|
|
|
|
} |
487
|
|
|
|
|
|
|
} |
488
|
|
|
|
|
|
|
|
489
|
2
|
50
|
|
|
|
11
|
return @paths ? (-f $paths[0] ? $paths[0]->parent : $paths[0]) : undef; |
|
|
100
|
|
|
|
|
|
490
|
|
|
|
|
|
|
} |
491
|
|
|
|
|
|
|
|
492
|
|
|
|
|
|
|
sub seek { |
493
|
20
|
|
|
20
|
1
|
53
|
my ($self, $spec, $base) = @_; |
494
|
|
|
|
|
|
|
|
495
|
20
|
100
|
|
|
|
56
|
if ((my $path = $self->child($base))->test($spec)) { |
496
|
1
|
|
|
|
|
8
|
return $path; |
497
|
|
|
|
|
|
|
} |
498
|
|
|
|
|
|
|
else { |
499
|
19
|
|
|
|
|
122
|
for my $path ($self->directories) { |
500
|
18
|
|
|
|
|
75
|
my $sought = $path->seek($spec, $base); |
501
|
18
|
100
|
|
|
|
55
|
return $sought if $sought; |
502
|
|
|
|
|
|
|
} |
503
|
17
|
|
|
|
|
75
|
return undef; |
504
|
|
|
|
|
|
|
} |
505
|
|
|
|
|
|
|
} |
506
|
|
|
|
|
|
|
|
507
|
|
|
|
|
|
|
sub sibling { |
508
|
5
|
|
|
5
|
1
|
28
|
my ($self, $path) = @_; |
509
|
|
|
|
|
|
|
|
510
|
5
|
|
|
|
|
27
|
require File::Basename; |
511
|
5
|
|
|
|
|
21
|
require File::Spec; |
512
|
|
|
|
|
|
|
|
513
|
5
|
|
|
|
|
33
|
return $self->class->new(File::Spec->catfile( |
514
|
|
|
|
|
|
|
File::Basename::dirname($self->get), $path)); |
515
|
|
|
|
|
|
|
} |
516
|
|
|
|
|
|
|
|
517
|
|
|
|
|
|
|
sub siblings { |
518
|
1
|
|
|
1
|
1
|
4
|
my ($self) = @_; |
519
|
|
|
|
|
|
|
|
520
|
1
|
|
|
|
|
8
|
my @paths = map $self->parent->glob($_), '.??*', '*'; |
521
|
|
|
|
|
|
|
|
522
|
1
|
|
|
|
|
10
|
my %seen = ($self->absolute, 1); |
523
|
|
|
|
|
|
|
|
524
|
1
|
|
|
|
|
6
|
@paths = grep !$seen{$_}++, @paths; |
525
|
|
|
|
|
|
|
|
526
|
1
|
50
|
|
|
|
18
|
return wantarray ? (@paths) : \@paths; |
527
|
|
|
|
|
|
|
} |
528
|
|
|
|
|
|
|
|
529
|
|
|
|
|
|
|
sub test { |
530
|
37
|
|
|
37
|
1
|
1151
|
my ($self, $spec) = @_; |
531
|
|
|
|
|
|
|
|
532
|
|
|
|
|
|
|
return eval( |
533
|
37
|
|
100
|
|
|
2209
|
join(' ', map("-$_", grep(/^[a-zA-Z]$/, split(//, $spec || 'e'))), '$self') |
534
|
|
|
|
|
|
|
); |
535
|
|
|
|
|
|
|
} |
536
|
|
|
|
|
|
|
|
537
|
|
|
|
|
|
|
sub unlink { |
538
|
11
|
|
|
11
|
1
|
870
|
my ($self) = @_; |
539
|
|
|
|
|
|
|
|
540
|
11
|
|
|
|
|
47
|
my $path = $self->get; |
541
|
|
|
|
|
|
|
|
542
|
11
|
100
|
|
|
|
574
|
CORE::unlink($path) |
543
|
|
|
|
|
|
|
or $self->throw('error_on_unlink', $path, $!)->error; |
544
|
|
|
|
|
|
|
|
545
|
10
|
|
|
|
|
76
|
return $self; |
546
|
|
|
|
|
|
|
} |
547
|
|
|
|
|
|
|
|
548
|
|
|
|
|
|
|
sub write { |
549
|
3
|
|
|
3
|
1
|
10
|
my ($self, $data, $binmode) = @_; |
550
|
|
|
|
|
|
|
|
551
|
3
|
|
|
|
|
13
|
my $path = $self->get; |
552
|
|
|
|
|
|
|
|
553
|
3
|
100
|
|
|
|
292
|
CORE::open(my $handle, '>', $path) |
554
|
|
|
|
|
|
|
or $self->throw('error_on_write_open', $path, $!)->error; |
555
|
|
|
|
|
|
|
|
556
|
2
|
50
|
0
|
|
|
14
|
CORE::binmode($handle, $binmode) or do { |
557
|
0
|
|
|
|
|
0
|
$self->throw('error_on_write_binmode', $path, $binmode, $!)->error; |
558
|
|
|
|
|
|
|
} if defined($binmode); |
559
|
|
|
|
|
|
|
|
560
|
2
|
50
|
50
|
|
|
37
|
(($handle->syswrite($data) // -1) == length($data)) |
561
|
|
|
|
|
|
|
or $self->throw('error_on_write_error', $path, $!)->error; |
562
|
|
|
|
|
|
|
|
563
|
2
|
|
|
|
|
193
|
return $self; |
564
|
|
|
|
|
|
|
} |
565
|
|
|
|
|
|
|
|
566
|
|
|
|
|
|
|
# ERRORS |
567
|
|
|
|
|
|
|
|
568
|
|
|
|
|
|
|
sub error_on_copy { |
569
|
1
|
|
|
1
|
1
|
4
|
my ($self, $path, $err) = @_; |
570
|
|
|
|
|
|
|
|
571
|
1
|
50
|
|
|
|
15
|
$err = "" if !defined $err; |
572
|
|
|
|
|
|
|
|
573
|
|
|
|
|
|
|
return { |
574
|
1
|
|
|
|
|
9
|
name => 'on.copy', |
575
|
|
|
|
|
|
|
message => "Can't copy \"$self\" to \"$path\": $err", |
576
|
|
|
|
|
|
|
stash => { |
577
|
|
|
|
|
|
|
path => $path, |
578
|
|
|
|
|
|
|
self => $self, |
579
|
|
|
|
|
|
|
}, |
580
|
|
|
|
|
|
|
}; |
581
|
|
|
|
|
|
|
} |
582
|
|
|
|
|
|
|
|
583
|
|
|
|
|
|
|
sub error_on_mkcall { |
584
|
2
|
|
|
2
|
1
|
35
|
my ($self, $path, $err) = @_; |
585
|
|
|
|
|
|
|
|
586
|
2
|
100
|
|
|
|
45
|
$err = "" if !defined $err; |
587
|
|
|
|
|
|
|
|
588
|
|
|
|
|
|
|
return { |
589
|
2
|
100
|
|
|
|
75
|
name => 'on.mkcall', |
590
|
|
|
|
|
|
|
message => ("Can't make system call to \"$path\": " |
591
|
|
|
|
|
|
|
. ($err ? "$err" : sprintf("exit code (%s)", _exitcode()))), |
592
|
|
|
|
|
|
|
stash => { |
593
|
|
|
|
|
|
|
path => $path, |
594
|
|
|
|
|
|
|
}, |
595
|
|
|
|
|
|
|
}; |
596
|
|
|
|
|
|
|
} |
597
|
|
|
|
|
|
|
|
598
|
|
|
|
|
|
|
sub error_on_mkdir { |
599
|
3
|
|
|
3
|
1
|
16
|
my ($self, $path, $err) = @_; |
600
|
|
|
|
|
|
|
|
601
|
3
|
100
|
|
|
|
24
|
$err = "" if !defined $err; |
602
|
|
|
|
|
|
|
|
603
|
|
|
|
|
|
|
return { |
604
|
3
|
|
|
|
|
35
|
name => 'on.mkdir', |
605
|
|
|
|
|
|
|
message => "Can't make directory \"$path\": $err", |
606
|
|
|
|
|
|
|
stash => { |
607
|
|
|
|
|
|
|
path => $path, |
608
|
|
|
|
|
|
|
}, |
609
|
|
|
|
|
|
|
}; |
610
|
|
|
|
|
|
|
} |
611
|
|
|
|
|
|
|
|
612
|
|
|
|
|
|
|
sub error_on_mkfile { |
613
|
1
|
|
|
1
|
1
|
5
|
my ($self, $path, $err) = @_; |
614
|
|
|
|
|
|
|
|
615
|
1
|
50
|
|
|
|
30
|
$err = "" if !defined $err; |
616
|
|
|
|
|
|
|
|
617
|
|
|
|
|
|
|
return { |
618
|
1
|
|
|
|
|
23
|
name => 'on.mkfile', |
619
|
|
|
|
|
|
|
message => "Can't make file \"$path\": $err", |
620
|
|
|
|
|
|
|
stash => { |
621
|
|
|
|
|
|
|
path => $path, |
622
|
|
|
|
|
|
|
}, |
623
|
|
|
|
|
|
|
}; |
624
|
|
|
|
|
|
|
} |
625
|
|
|
|
|
|
|
|
626
|
|
|
|
|
|
|
sub error_on_move { |
627
|
1
|
|
|
1
|
1
|
5
|
my ($self, $path, $err) = @_; |
628
|
|
|
|
|
|
|
|
629
|
1
|
50
|
|
|
|
24
|
$err = "" if !defined $err; |
630
|
|
|
|
|
|
|
|
631
|
|
|
|
|
|
|
return { |
632
|
1
|
|
|
|
|
14
|
name => 'on.move', |
633
|
|
|
|
|
|
|
message => "Can't move \"$self\" to \"$path\": $err", |
634
|
|
|
|
|
|
|
stash => { |
635
|
|
|
|
|
|
|
path => $path, |
636
|
|
|
|
|
|
|
self => $self, |
637
|
|
|
|
|
|
|
}, |
638
|
|
|
|
|
|
|
}; |
639
|
|
|
|
|
|
|
} |
640
|
|
|
|
|
|
|
|
641
|
|
|
|
|
|
|
sub error_on_open { |
642
|
3
|
|
|
3
|
1
|
10
|
my ($self, $path, $err) = @_; |
643
|
|
|
|
|
|
|
|
644
|
3
|
100
|
|
|
|
20
|
$err = "" if !defined $err; |
645
|
|
|
|
|
|
|
|
646
|
|
|
|
|
|
|
return { |
647
|
3
|
|
|
|
|
34
|
name => 'on.open', |
648
|
|
|
|
|
|
|
message => "Can't open \"$path\": $err", |
649
|
|
|
|
|
|
|
stash => { |
650
|
|
|
|
|
|
|
path => $path, |
651
|
|
|
|
|
|
|
}, |
652
|
|
|
|
|
|
|
}; |
653
|
|
|
|
|
|
|
} |
654
|
|
|
|
|
|
|
|
655
|
|
|
|
|
|
|
sub error_on_read_binmode { |
656
|
1
|
|
|
1
|
1
|
5
|
my ($self, $path, $binmode, $err) = @_; |
657
|
|
|
|
|
|
|
|
658
|
1
|
50
|
|
|
|
19
|
$err = "" if !defined $err; |
659
|
|
|
|
|
|
|
|
660
|
|
|
|
|
|
|
return { |
661
|
1
|
|
|
|
|
21
|
name => 'on.read.binmode', |
662
|
|
|
|
|
|
|
message => "Can't binmode \"$path\": $err", |
663
|
|
|
|
|
|
|
stash => { |
664
|
|
|
|
|
|
|
binmode => $binmode, |
665
|
|
|
|
|
|
|
path => $path, |
666
|
|
|
|
|
|
|
}, |
667
|
|
|
|
|
|
|
}; |
668
|
|
|
|
|
|
|
} |
669
|
|
|
|
|
|
|
|
670
|
|
|
|
|
|
|
sub error_on_read_error { |
671
|
1
|
|
|
1
|
1
|
5
|
my ($self, $path, $err) = @_; |
672
|
|
|
|
|
|
|
|
673
|
1
|
50
|
|
|
|
19
|
$err = "" if !defined $err; |
674
|
|
|
|
|
|
|
|
675
|
|
|
|
|
|
|
return { |
676
|
1
|
|
|
|
|
15
|
name => 'on.read.error', |
677
|
|
|
|
|
|
|
message => "Can't read from file \"$path\": $err", |
678
|
|
|
|
|
|
|
stash => { |
679
|
|
|
|
|
|
|
path => $path, |
680
|
|
|
|
|
|
|
}, |
681
|
|
|
|
|
|
|
}; |
682
|
|
|
|
|
|
|
} |
683
|
|
|
|
|
|
|
|
684
|
|
|
|
|
|
|
sub error_on_read_open { |
685
|
2
|
|
|
2
|
1
|
16
|
my ($self, $path, $err) = @_; |
686
|
|
|
|
|
|
|
|
687
|
2
|
100
|
|
|
|
12
|
$err = "" if !defined $err; |
688
|
|
|
|
|
|
|
|
689
|
|
|
|
|
|
|
return { |
690
|
2
|
|
|
|
|
37
|
name => 'on.read.open', |
691
|
|
|
|
|
|
|
message => "Can't read \"$path\": $err", |
692
|
|
|
|
|
|
|
stash => { |
693
|
|
|
|
|
|
|
path => $path, |
694
|
|
|
|
|
|
|
}, |
695
|
|
|
|
|
|
|
}; |
696
|
|
|
|
|
|
|
} |
697
|
|
|
|
|
|
|
|
698
|
|
|
|
|
|
|
sub error_on_rmdir { |
699
|
1
|
|
|
1
|
1
|
4
|
my ($self, $path, $err) = @_; |
700
|
|
|
|
|
|
|
|
701
|
1
|
50
|
|
|
|
21
|
$err = "" if !defined $err; |
702
|
|
|
|
|
|
|
|
703
|
|
|
|
|
|
|
return { |
704
|
1
|
|
|
|
|
17
|
name => 'on.rmdir', |
705
|
|
|
|
|
|
|
message => "Can't rmdir \"$path\": $err", |
706
|
|
|
|
|
|
|
stash => { |
707
|
|
|
|
|
|
|
path => $path, |
708
|
|
|
|
|
|
|
}, |
709
|
|
|
|
|
|
|
}; |
710
|
|
|
|
|
|
|
} |
711
|
|
|
|
|
|
|
|
712
|
|
|
|
|
|
|
sub error_on_write_binmode { |
713
|
1
|
|
|
1
|
1
|
5
|
my ($self, $path, $binmode, $err) = @_; |
714
|
|
|
|
|
|
|
|
715
|
1
|
50
|
|
|
|
6
|
$err = "" if !defined $err; |
716
|
|
|
|
|
|
|
|
717
|
|
|
|
|
|
|
return { |
718
|
1
|
|
|
|
|
33
|
name => 'on.write.binmode', |
719
|
|
|
|
|
|
|
message => "Can't binmode \"$path\": $err", |
720
|
|
|
|
|
|
|
stash => { |
721
|
|
|
|
|
|
|
binmode => $binmode, |
722
|
|
|
|
|
|
|
path => $path, |
723
|
|
|
|
|
|
|
}, |
724
|
|
|
|
|
|
|
}; |
725
|
|
|
|
|
|
|
} |
726
|
|
|
|
|
|
|
|
727
|
|
|
|
|
|
|
sub error_on_write_error { |
728
|
1
|
|
|
1
|
1
|
4
|
my ($self, $path, $err) = @_; |
729
|
|
|
|
|
|
|
|
730
|
1
|
50
|
|
|
|
6
|
$err = "" if !defined $err; |
731
|
|
|
|
|
|
|
|
732
|
|
|
|
|
|
|
return { |
733
|
1
|
|
|
|
|
24
|
name => 'on.write.error', |
734
|
|
|
|
|
|
|
message => "Can't write to file \"$path\": $err", |
735
|
|
|
|
|
|
|
stash => { |
736
|
|
|
|
|
|
|
path => $path, |
737
|
|
|
|
|
|
|
}, |
738
|
|
|
|
|
|
|
}; |
739
|
|
|
|
|
|
|
} |
740
|
|
|
|
|
|
|
|
741
|
|
|
|
|
|
|
sub error_on_write_open { |
742
|
2
|
|
|
2
|
1
|
8
|
my ($self, $path, $err) = @_; |
743
|
|
|
|
|
|
|
|
744
|
2
|
100
|
|
|
|
27
|
$err = "" if !defined $err; |
745
|
|
|
|
|
|
|
|
746
|
|
|
|
|
|
|
return { |
747
|
2
|
|
|
|
|
45
|
name => 'on.write.open', |
748
|
|
|
|
|
|
|
message => "Can't write \"$path\": $err", |
749
|
|
|
|
|
|
|
stash => { |
750
|
|
|
|
|
|
|
path => $path, |
751
|
|
|
|
|
|
|
}, |
752
|
|
|
|
|
|
|
}; |
753
|
|
|
|
|
|
|
} |
754
|
|
|
|
|
|
|
|
755
|
|
|
|
|
|
|
sub error_on_unlink { |
756
|
2
|
|
|
2
|
1
|
10
|
my ($self, $path, $err) = @_; |
757
|
|
|
|
|
|
|
|
758
|
2
|
100
|
|
|
|
9
|
$err = "" if !defined $err; |
759
|
|
|
|
|
|
|
|
760
|
|
|
|
|
|
|
return { |
761
|
2
|
|
|
|
|
24
|
name => 'on.unlink', |
762
|
|
|
|
|
|
|
message => "Can't unlink \"$path\": $err", |
763
|
|
|
|
|
|
|
stash => { |
764
|
|
|
|
|
|
|
path => $path, |
765
|
|
|
|
|
|
|
}, |
766
|
|
|
|
|
|
|
}; |
767
|
|
|
|
|
|
|
} |
768
|
|
|
|
|
|
|
|
769
|
|
|
|
|
|
|
1; |
770
|
|
|
|
|
|
|
|
771
|
|
|
|
|
|
|
|
772
|
|
|
|
|
|
|
|
773
|
|
|
|
|
|
|
=head1 NAME |
774
|
|
|
|
|
|
|
|
775
|
|
|
|
|
|
|
Venus::Path - Path Class |
776
|
|
|
|
|
|
|
|
777
|
|
|
|
|
|
|
=cut |
778
|
|
|
|
|
|
|
|
779
|
|
|
|
|
|
|
=head1 ABSTRACT |
780
|
|
|
|
|
|
|
|
781
|
|
|
|
|
|
|
Path Class for Perl 5 |
782
|
|
|
|
|
|
|
|
783
|
|
|
|
|
|
|
=cut |
784
|
|
|
|
|
|
|
|
785
|
|
|
|
|
|
|
=head1 SYNOPSIS |
786
|
|
|
|
|
|
|
|
787
|
|
|
|
|
|
|
package main; |
788
|
|
|
|
|
|
|
|
789
|
|
|
|
|
|
|
use Venus::Path; |
790
|
|
|
|
|
|
|
|
791
|
|
|
|
|
|
|
my $path = Venus::Path->new('t/data/planets'); |
792
|
|
|
|
|
|
|
|
793
|
|
|
|
|
|
|
# my $planets = $path->files; |
794
|
|
|
|
|
|
|
# my $mercury = $path->child('mercury'); |
795
|
|
|
|
|
|
|
# my $content = $mercury->read; |
796
|
|
|
|
|
|
|
|
797
|
|
|
|
|
|
|
=cut |
798
|
|
|
|
|
|
|
|
799
|
|
|
|
|
|
|
=head1 DESCRIPTION |
800
|
|
|
|
|
|
|
|
801
|
|
|
|
|
|
|
This package provides methods for working with file system paths. |
802
|
|
|
|
|
|
|
|
803
|
|
|
|
|
|
|
=cut |
804
|
|
|
|
|
|
|
|
805
|
|
|
|
|
|
|
=head1 INHERITS |
806
|
|
|
|
|
|
|
|
807
|
|
|
|
|
|
|
This package inherits behaviors from: |
808
|
|
|
|
|
|
|
|
809
|
|
|
|
|
|
|
L |
810
|
|
|
|
|
|
|
|
811
|
|
|
|
|
|
|
=cut |
812
|
|
|
|
|
|
|
|
813
|
|
|
|
|
|
|
=head1 INTEGRATES |
814
|
|
|
|
|
|
|
|
815
|
|
|
|
|
|
|
This package integrates behaviors from: |
816
|
|
|
|
|
|
|
|
817
|
|
|
|
|
|
|
L |
818
|
|
|
|
|
|
|
|
819
|
|
|
|
|
|
|
L |
820
|
|
|
|
|
|
|
|
821
|
|
|
|
|
|
|
L |
822
|
|
|
|
|
|
|
|
823
|
|
|
|
|
|
|
L |
824
|
|
|
|
|
|
|
|
825
|
|
|
|
|
|
|
=cut |
826
|
|
|
|
|
|
|
|
827
|
|
|
|
|
|
|
=head1 METHODS |
828
|
|
|
|
|
|
|
|
829
|
|
|
|
|
|
|
This package provides the following methods: |
830
|
|
|
|
|
|
|
|
831
|
|
|
|
|
|
|
=cut |
832
|
|
|
|
|
|
|
|
833
|
|
|
|
|
|
|
=head2 absolute |
834
|
|
|
|
|
|
|
|
835
|
|
|
|
|
|
|
absolute() (Path) |
836
|
|
|
|
|
|
|
|
837
|
|
|
|
|
|
|
The absolute method returns a path object where the value (path) is absolute. |
838
|
|
|
|
|
|
|
|
839
|
|
|
|
|
|
|
I> |
840
|
|
|
|
|
|
|
|
841
|
|
|
|
|
|
|
=over 4 |
842
|
|
|
|
|
|
|
|
843
|
|
|
|
|
|
|
=item absolute example 1 |
844
|
|
|
|
|
|
|
|
845
|
|
|
|
|
|
|
# given: synopsis; |
846
|
|
|
|
|
|
|
|
847
|
|
|
|
|
|
|
$path = $path->absolute; |
848
|
|
|
|
|
|
|
|
849
|
|
|
|
|
|
|
# bless({ value => "/path/to/t/data/planets" }, "Venus::Path") |
850
|
|
|
|
|
|
|
|
851
|
|
|
|
|
|
|
=back |
852
|
|
|
|
|
|
|
|
853
|
|
|
|
|
|
|
=cut |
854
|
|
|
|
|
|
|
|
855
|
|
|
|
|
|
|
=head2 basename |
856
|
|
|
|
|
|
|
|
857
|
|
|
|
|
|
|
basename() (Str) |
858
|
|
|
|
|
|
|
|
859
|
|
|
|
|
|
|
The basename method returns the path base name. |
860
|
|
|
|
|
|
|
|
861
|
|
|
|
|
|
|
I> |
862
|
|
|
|
|
|
|
|
863
|
|
|
|
|
|
|
=over 4 |
864
|
|
|
|
|
|
|
|
865
|
|
|
|
|
|
|
=item basename example 1 |
866
|
|
|
|
|
|
|
|
867
|
|
|
|
|
|
|
# given: synopsis; |
868
|
|
|
|
|
|
|
|
869
|
|
|
|
|
|
|
my $basename = $path->basename; |
870
|
|
|
|
|
|
|
|
871
|
|
|
|
|
|
|
# planets |
872
|
|
|
|
|
|
|
|
873
|
|
|
|
|
|
|
=back |
874
|
|
|
|
|
|
|
|
875
|
|
|
|
|
|
|
=cut |
876
|
|
|
|
|
|
|
|
877
|
|
|
|
|
|
|
=head2 child |
878
|
|
|
|
|
|
|
|
879
|
|
|
|
|
|
|
child(Str $path) (Path) |
880
|
|
|
|
|
|
|
|
881
|
|
|
|
|
|
|
The child method returns a path object representing the child path provided. |
882
|
|
|
|
|
|
|
|
883
|
|
|
|
|
|
|
I> |
884
|
|
|
|
|
|
|
|
885
|
|
|
|
|
|
|
=over 4 |
886
|
|
|
|
|
|
|
|
887
|
|
|
|
|
|
|
=item child example 1 |
888
|
|
|
|
|
|
|
|
889
|
|
|
|
|
|
|
# given: synopsis; |
890
|
|
|
|
|
|
|
|
891
|
|
|
|
|
|
|
$path = $path->child('earth'); |
892
|
|
|
|
|
|
|
|
893
|
|
|
|
|
|
|
# bless({ value => "t/data/planets/earth" }, "Venus::Path") |
894
|
|
|
|
|
|
|
|
895
|
|
|
|
|
|
|
=back |
896
|
|
|
|
|
|
|
|
897
|
|
|
|
|
|
|
=cut |
898
|
|
|
|
|
|
|
|
899
|
|
|
|
|
|
|
=head2 children |
900
|
|
|
|
|
|
|
|
901
|
|
|
|
|
|
|
children() (ArrayRef[Path]) |
902
|
|
|
|
|
|
|
|
903
|
|
|
|
|
|
|
The children method returns the files and directories under the path. This |
904
|
|
|
|
|
|
|
method can return a list of values in list-context. |
905
|
|
|
|
|
|
|
|
906
|
|
|
|
|
|
|
I> |
907
|
|
|
|
|
|
|
|
908
|
|
|
|
|
|
|
=over 4 |
909
|
|
|
|
|
|
|
|
910
|
|
|
|
|
|
|
=item children example 1 |
911
|
|
|
|
|
|
|
|
912
|
|
|
|
|
|
|
# given: synopsis; |
913
|
|
|
|
|
|
|
|
914
|
|
|
|
|
|
|
my $children = $path->children; |
915
|
|
|
|
|
|
|
|
916
|
|
|
|
|
|
|
# [ |
917
|
|
|
|
|
|
|
# bless({ value => "t/data/planets/ceres" }, "Venus::Path"), |
918
|
|
|
|
|
|
|
# bless({ value => "t/data/planets/earth" }, "Venus::Path"), |
919
|
|
|
|
|
|
|
# bless({ value => "t/data/planets/eris" }, "Venus::Path"), |
920
|
|
|
|
|
|
|
# bless({ value => "t/data/planets/haumea" }, "Venus::Path"), |
921
|
|
|
|
|
|
|
# bless({ value => "t/data/planets/jupiter" }, "Venus::Path"), |
922
|
|
|
|
|
|
|
# bless({ value => "t/data/planets/makemake" }, "Venus::Path"), |
923
|
|
|
|
|
|
|
# bless({ value => "t/data/planets/mars" }, "Venus::Path"), |
924
|
|
|
|
|
|
|
# bless({ value => "t/data/planets/mercury" }, "Venus::Path"), |
925
|
|
|
|
|
|
|
# bless({ value => "t/data/planets/neptune" }, "Venus::Path"), |
926
|
|
|
|
|
|
|
# bless({ value => "t/data/planets/planet9" }, "Venus::Path"), |
927
|
|
|
|
|
|
|
# bless({ value => "t/data/planets/pluto" }, "Venus::Path"), |
928
|
|
|
|
|
|
|
# bless({ value => "t/data/planets/saturn" }, "Venus::Path"), |
929
|
|
|
|
|
|
|
# bless({ value => "t/data/planets/uranus" }, "Venus::Path"), |
930
|
|
|
|
|
|
|
# bless({ value => "t/data/planets/venus" }, "Venus::Path"), |
931
|
|
|
|
|
|
|
# ] |
932
|
|
|
|
|
|
|
|
933
|
|
|
|
|
|
|
=back |
934
|
|
|
|
|
|
|
|
935
|
|
|
|
|
|
|
=cut |
936
|
|
|
|
|
|
|
|
937
|
|
|
|
|
|
|
=head2 chmod |
938
|
|
|
|
|
|
|
|
939
|
|
|
|
|
|
|
chmod(Str $mode) (Path) |
940
|
|
|
|
|
|
|
|
941
|
|
|
|
|
|
|
The chmod method changes the file permissions of the file or directory. |
942
|
|
|
|
|
|
|
|
943
|
|
|
|
|
|
|
I> |
944
|
|
|
|
|
|
|
|
945
|
|
|
|
|
|
|
=over 4 |
946
|
|
|
|
|
|
|
|
947
|
|
|
|
|
|
|
=item chmod example 1 |
948
|
|
|
|
|
|
|
|
949
|
|
|
|
|
|
|
# given: synopsis; |
950
|
|
|
|
|
|
|
|
951
|
|
|
|
|
|
|
$path = $path->chmod(0755); |
952
|
|
|
|
|
|
|
|
953
|
|
|
|
|
|
|
# bless({ value => "t/data/planets" }, "Venus::Path") |
954
|
|
|
|
|
|
|
|
955
|
|
|
|
|
|
|
=back |
956
|
|
|
|
|
|
|
|
957
|
|
|
|
|
|
|
=cut |
958
|
|
|
|
|
|
|
|
959
|
|
|
|
|
|
|
=head2 chown |
960
|
|
|
|
|
|
|
|
961
|
|
|
|
|
|
|
chown(Str @args) (Path) |
962
|
|
|
|
|
|
|
|
963
|
|
|
|
|
|
|
The chown method changes the group and/or owner or the file or directory. |
964
|
|
|
|
|
|
|
|
965
|
|
|
|
|
|
|
I> |
966
|
|
|
|
|
|
|
|
967
|
|
|
|
|
|
|
=over 4 |
968
|
|
|
|
|
|
|
|
969
|
|
|
|
|
|
|
=item chown example 1 |
970
|
|
|
|
|
|
|
|
971
|
|
|
|
|
|
|
# given: synopsis; |
972
|
|
|
|
|
|
|
|
973
|
|
|
|
|
|
|
$path = $path->chown(-1, -1); |
974
|
|
|
|
|
|
|
|
975
|
|
|
|
|
|
|
# bless({ value => "t/data/planets" }, "Venus::Path") |
976
|
|
|
|
|
|
|
|
977
|
|
|
|
|
|
|
=back |
978
|
|
|
|
|
|
|
|
979
|
|
|
|
|
|
|
=cut |
980
|
|
|
|
|
|
|
|
981
|
|
|
|
|
|
|
=head2 copy |
982
|
|
|
|
|
|
|
|
983
|
|
|
|
|
|
|
copy(Str | Path $path) (Path) |
984
|
|
|
|
|
|
|
|
985
|
|
|
|
|
|
|
The copy method uses L to copy the file represented by the |
986
|
|
|
|
|
|
|
invocant to the path provided and returns the invocant. |
987
|
|
|
|
|
|
|
|
988
|
|
|
|
|
|
|
I> |
989
|
|
|
|
|
|
|
|
990
|
|
|
|
|
|
|
=over 4 |
991
|
|
|
|
|
|
|
|
992
|
|
|
|
|
|
|
=item copy example 1 |
993
|
|
|
|
|
|
|
|
994
|
|
|
|
|
|
|
# given: synopsis |
995
|
|
|
|
|
|
|
|
996
|
|
|
|
|
|
|
package main; |
997
|
|
|
|
|
|
|
|
998
|
|
|
|
|
|
|
my $copy = $path->child('mercury')->copy($path->child('yrucrem')); |
999
|
|
|
|
|
|
|
|
1000
|
|
|
|
|
|
|
# bless({...}, 'Venus::Path') |
1001
|
|
|
|
|
|
|
|
1002
|
|
|
|
|
|
|
=back |
1003
|
|
|
|
|
|
|
|
1004
|
|
|
|
|
|
|
=cut |
1005
|
|
|
|
|
|
|
|
1006
|
|
|
|
|
|
|
=head2 default |
1007
|
|
|
|
|
|
|
|
1008
|
|
|
|
|
|
|
default() (Str) |
1009
|
|
|
|
|
|
|
|
1010
|
|
|
|
|
|
|
The default method returns the default value, i.e. C<$ENV{PWD}>. |
1011
|
|
|
|
|
|
|
|
1012
|
|
|
|
|
|
|
I> |
1013
|
|
|
|
|
|
|
|
1014
|
|
|
|
|
|
|
=over 4 |
1015
|
|
|
|
|
|
|
|
1016
|
|
|
|
|
|
|
=item default example 1 |
1017
|
|
|
|
|
|
|
|
1018
|
|
|
|
|
|
|
# given: synopsis; |
1019
|
|
|
|
|
|
|
|
1020
|
|
|
|
|
|
|
my $default = $path->default; |
1021
|
|
|
|
|
|
|
|
1022
|
|
|
|
|
|
|
# $ENV{PWD} |
1023
|
|
|
|
|
|
|
|
1024
|
|
|
|
|
|
|
=back |
1025
|
|
|
|
|
|
|
|
1026
|
|
|
|
|
|
|
=cut |
1027
|
|
|
|
|
|
|
|
1028
|
|
|
|
|
|
|
=head2 directories |
1029
|
|
|
|
|
|
|
|
1030
|
|
|
|
|
|
|
directories() (ArrayRef[Path]) |
1031
|
|
|
|
|
|
|
|
1032
|
|
|
|
|
|
|
The directories method returns a list of children under the path which are |
1033
|
|
|
|
|
|
|
directories. This method can return a list of values in list-context. |
1034
|
|
|
|
|
|
|
|
1035
|
|
|
|
|
|
|
I> |
1036
|
|
|
|
|
|
|
|
1037
|
|
|
|
|
|
|
=over 4 |
1038
|
|
|
|
|
|
|
|
1039
|
|
|
|
|
|
|
=item directories example 1 |
1040
|
|
|
|
|
|
|
|
1041
|
|
|
|
|
|
|
# given: synopsis; |
1042
|
|
|
|
|
|
|
|
1043
|
|
|
|
|
|
|
my $directories = $path->directories; |
1044
|
|
|
|
|
|
|
|
1045
|
|
|
|
|
|
|
# [] |
1046
|
|
|
|
|
|
|
|
1047
|
|
|
|
|
|
|
=back |
1048
|
|
|
|
|
|
|
|
1049
|
|
|
|
|
|
|
=cut |
1050
|
|
|
|
|
|
|
|
1051
|
|
|
|
|
|
|
=head2 exists |
1052
|
|
|
|
|
|
|
|
1053
|
|
|
|
|
|
|
exists() (Bool) |
1054
|
|
|
|
|
|
|
|
1055
|
|
|
|
|
|
|
The exists method returns truthy or falsy if the path exists. |
1056
|
|
|
|
|
|
|
|
1057
|
|
|
|
|
|
|
I> |
1058
|
|
|
|
|
|
|
|
1059
|
|
|
|
|
|
|
=over 4 |
1060
|
|
|
|
|
|
|
|
1061
|
|
|
|
|
|
|
=item exists example 1 |
1062
|
|
|
|
|
|
|
|
1063
|
|
|
|
|
|
|
# given: synopsis; |
1064
|
|
|
|
|
|
|
|
1065
|
|
|
|
|
|
|
my $exists = $path->exists; |
1066
|
|
|
|
|
|
|
|
1067
|
|
|
|
|
|
|
# 1 |
1068
|
|
|
|
|
|
|
|
1069
|
|
|
|
|
|
|
=back |
1070
|
|
|
|
|
|
|
|
1071
|
|
|
|
|
|
|
=over 4 |
1072
|
|
|
|
|
|
|
|
1073
|
|
|
|
|
|
|
=item exists example 2 |
1074
|
|
|
|
|
|
|
|
1075
|
|
|
|
|
|
|
# given: synopsis; |
1076
|
|
|
|
|
|
|
|
1077
|
|
|
|
|
|
|
my $exists = $path->child('random')->exists; |
1078
|
|
|
|
|
|
|
|
1079
|
|
|
|
|
|
|
# 0 |
1080
|
|
|
|
|
|
|
|
1081
|
|
|
|
|
|
|
=back |
1082
|
|
|
|
|
|
|
|
1083
|
|
|
|
|
|
|
=cut |
1084
|
|
|
|
|
|
|
|
1085
|
|
|
|
|
|
|
=head2 explain |
1086
|
|
|
|
|
|
|
|
1087
|
|
|
|
|
|
|
explain() (Str) |
1088
|
|
|
|
|
|
|
|
1089
|
|
|
|
|
|
|
The explain method returns the path string and is used in stringification |
1090
|
|
|
|
|
|
|
operations. |
1091
|
|
|
|
|
|
|
|
1092
|
|
|
|
|
|
|
I> |
1093
|
|
|
|
|
|
|
|
1094
|
|
|
|
|
|
|
=over 4 |
1095
|
|
|
|
|
|
|
|
1096
|
|
|
|
|
|
|
=item explain example 1 |
1097
|
|
|
|
|
|
|
|
1098
|
|
|
|
|
|
|
# given: synopsis; |
1099
|
|
|
|
|
|
|
|
1100
|
|
|
|
|
|
|
my $explain = $path->explain; |
1101
|
|
|
|
|
|
|
|
1102
|
|
|
|
|
|
|
# t/data/planets |
1103
|
|
|
|
|
|
|
|
1104
|
|
|
|
|
|
|
=back |
1105
|
|
|
|
|
|
|
|
1106
|
|
|
|
|
|
|
=cut |
1107
|
|
|
|
|
|
|
|
1108
|
|
|
|
|
|
|
=head2 extension |
1109
|
|
|
|
|
|
|
|
1110
|
|
|
|
|
|
|
extension(Str $name) (Str | Path) |
1111
|
|
|
|
|
|
|
|
1112
|
|
|
|
|
|
|
The extension method returns a new path object using the extension name |
1113
|
|
|
|
|
|
|
provided. If no argument is provided this method returns the extension for the |
1114
|
|
|
|
|
|
|
path represented by the invocant, otherwise returns undefined. |
1115
|
|
|
|
|
|
|
|
1116
|
|
|
|
|
|
|
I> |
1117
|
|
|
|
|
|
|
|
1118
|
|
|
|
|
|
|
=over 4 |
1119
|
|
|
|
|
|
|
|
1120
|
|
|
|
|
|
|
=item extension example 1 |
1121
|
|
|
|
|
|
|
|
1122
|
|
|
|
|
|
|
package main; |
1123
|
|
|
|
|
|
|
|
1124
|
|
|
|
|
|
|
use Venus::Path; |
1125
|
|
|
|
|
|
|
|
1126
|
|
|
|
|
|
|
my $path = Venus::Path->new('t/Venus_Path.t'); |
1127
|
|
|
|
|
|
|
|
1128
|
|
|
|
|
|
|
my $extension = $path->extension; |
1129
|
|
|
|
|
|
|
|
1130
|
|
|
|
|
|
|
# "t" |
1131
|
|
|
|
|
|
|
|
1132
|
|
|
|
|
|
|
=back |
1133
|
|
|
|
|
|
|
|
1134
|
|
|
|
|
|
|
=over 4 |
1135
|
|
|
|
|
|
|
|
1136
|
|
|
|
|
|
|
=item extension example 2 |
1137
|
|
|
|
|
|
|
|
1138
|
|
|
|
|
|
|
package main; |
1139
|
|
|
|
|
|
|
|
1140
|
|
|
|
|
|
|
use Venus::Path; |
1141
|
|
|
|
|
|
|
|
1142
|
|
|
|
|
|
|
my $path = Venus::Path->new('t/data/mercury'); |
1143
|
|
|
|
|
|
|
|
1144
|
|
|
|
|
|
|
my $extension = $path->extension('txt'); |
1145
|
|
|
|
|
|
|
|
1146
|
|
|
|
|
|
|
# bless({ value => "t/data/mercury.txt"}, "Venus::Path") |
1147
|
|
|
|
|
|
|
|
1148
|
|
|
|
|
|
|
=back |
1149
|
|
|
|
|
|
|
|
1150
|
|
|
|
|
|
|
=over 4 |
1151
|
|
|
|
|
|
|
|
1152
|
|
|
|
|
|
|
=item extension example 3 |
1153
|
|
|
|
|
|
|
|
1154
|
|
|
|
|
|
|
package main; |
1155
|
|
|
|
|
|
|
|
1156
|
|
|
|
|
|
|
use Venus::Path; |
1157
|
|
|
|
|
|
|
|
1158
|
|
|
|
|
|
|
my $path = Venus::Path->new('t/data'); |
1159
|
|
|
|
|
|
|
|
1160
|
|
|
|
|
|
|
my $extension = $path->extension; |
1161
|
|
|
|
|
|
|
|
1162
|
|
|
|
|
|
|
# undef |
1163
|
|
|
|
|
|
|
|
1164
|
|
|
|
|
|
|
=back |
1165
|
|
|
|
|
|
|
|
1166
|
|
|
|
|
|
|
=over 4 |
1167
|
|
|
|
|
|
|
|
1168
|
|
|
|
|
|
|
=item extension example 4 |
1169
|
|
|
|
|
|
|
|
1170
|
|
|
|
|
|
|
package main; |
1171
|
|
|
|
|
|
|
|
1172
|
|
|
|
|
|
|
use Venus::Path; |
1173
|
|
|
|
|
|
|
|
1174
|
|
|
|
|
|
|
my $path = Venus::Path->new('t/data'); |
1175
|
|
|
|
|
|
|
|
1176
|
|
|
|
|
|
|
my $extension = $path->extension('txt'); |
1177
|
|
|
|
|
|
|
|
1178
|
|
|
|
|
|
|
# bless({ value => "t/data.txt"}, "Venus::Path") |
1179
|
|
|
|
|
|
|
|
1180
|
|
|
|
|
|
|
=back |
1181
|
|
|
|
|
|
|
|
1182
|
|
|
|
|
|
|
=cut |
1183
|
|
|
|
|
|
|
|
1184
|
|
|
|
|
|
|
=head2 files |
1185
|
|
|
|
|
|
|
|
1186
|
|
|
|
|
|
|
files() (ArrayRef[Path]) |
1187
|
|
|
|
|
|
|
|
1188
|
|
|
|
|
|
|
The files method returns a list of children under the path which are files. |
1189
|
|
|
|
|
|
|
This method can return a list of values in list-context. |
1190
|
|
|
|
|
|
|
|
1191
|
|
|
|
|
|
|
I> |
1192
|
|
|
|
|
|
|
|
1193
|
|
|
|
|
|
|
=over 4 |
1194
|
|
|
|
|
|
|
|
1195
|
|
|
|
|
|
|
=item files example 1 |
1196
|
|
|
|
|
|
|
|
1197
|
|
|
|
|
|
|
# given: synopsis; |
1198
|
|
|
|
|
|
|
|
1199
|
|
|
|
|
|
|
my $files = $path->files; |
1200
|
|
|
|
|
|
|
|
1201
|
|
|
|
|
|
|
# [ |
1202
|
|
|
|
|
|
|
# bless({ value => "t/data/planets/ceres" }, "Venus::Path"), |
1203
|
|
|
|
|
|
|
# bless({ value => "t/data/planets/earth" }, "Venus::Path"), |
1204
|
|
|
|
|
|
|
# bless({ value => "t/data/planets/eris" }, "Venus::Path"), |
1205
|
|
|
|
|
|
|
# bless({ value => "t/data/planets/haumea" }, "Venus::Path"), |
1206
|
|
|
|
|
|
|
# bless({ value => "t/data/planets/jupiter" }, "Venus::Path"), |
1207
|
|
|
|
|
|
|
# bless({ value => "t/data/planets/makemake" }, "Venus::Path"), |
1208
|
|
|
|
|
|
|
# bless({ value => "t/data/planets/mars" }, "Venus::Path"), |
1209
|
|
|
|
|
|
|
# bless({ value => "t/data/planets/mercury" }, "Venus::Path"), |
1210
|
|
|
|
|
|
|
# bless({ value => "t/data/planets/neptune" }, "Venus::Path"), |
1211
|
|
|
|
|
|
|
# bless({ value => "t/data/planets/planet9" }, "Venus::Path"), |
1212
|
|
|
|
|
|
|
# bless({ value => "t/data/planets/pluto" }, "Venus::Path"), |
1213
|
|
|
|
|
|
|
# bless({ value => "t/data/planets/saturn" }, "Venus::Path"), |
1214
|
|
|
|
|
|
|
# bless({ value => "t/data/planets/uranus" }, "Venus::Path"), |
1215
|
|
|
|
|
|
|
# bless({ value => "t/data/planets/venus" }, "Venus::Path"), |
1216
|
|
|
|
|
|
|
# ] |
1217
|
|
|
|
|
|
|
|
1218
|
|
|
|
|
|
|
=back |
1219
|
|
|
|
|
|
|
|
1220
|
|
|
|
|
|
|
=cut |
1221
|
|
|
|
|
|
|
|
1222
|
|
|
|
|
|
|
=head2 find |
1223
|
|
|
|
|
|
|
|
1224
|
|
|
|
|
|
|
find(Str | Regexp $expr) (ArrayRef[Path]) |
1225
|
|
|
|
|
|
|
|
1226
|
|
|
|
|
|
|
The find method does a recursive depth-first search and returns a list of paths |
1227
|
|
|
|
|
|
|
found, matching the expression provided, which defaults to C<*>. This method |
1228
|
|
|
|
|
|
|
can return a list of values in list-context. |
1229
|
|
|
|
|
|
|
|
1230
|
|
|
|
|
|
|
I> |
1231
|
|
|
|
|
|
|
|
1232
|
|
|
|
|
|
|
=over 4 |
1233
|
|
|
|
|
|
|
|
1234
|
|
|
|
|
|
|
=item find example 1 |
1235
|
|
|
|
|
|
|
|
1236
|
|
|
|
|
|
|
# given: synopsis; |
1237
|
|
|
|
|
|
|
|
1238
|
|
|
|
|
|
|
my $find = $path->find; |
1239
|
|
|
|
|
|
|
|
1240
|
|
|
|
|
|
|
# [ |
1241
|
|
|
|
|
|
|
# bless({ value => "t/data/planets/ceres" }, "Venus::Path"), |
1242
|
|
|
|
|
|
|
# bless({ value => "t/data/planets/earth" }, "Venus::Path"), |
1243
|
|
|
|
|
|
|
# bless({ value => "t/data/planets/eris" }, "Venus::Path"), |
1244
|
|
|
|
|
|
|
# bless({ value => "t/data/planets/haumea" }, "Venus::Path"), |
1245
|
|
|
|
|
|
|
# bless({ value => "t/data/planets/jupiter" }, "Venus::Path"), |
1246
|
|
|
|
|
|
|
# bless({ value => "t/data/planets/makemake" }, "Venus::Path"), |
1247
|
|
|
|
|
|
|
# bless({ value => "t/data/planets/mars" }, "Venus::Path"), |
1248
|
|
|
|
|
|
|
# bless({ value => "t/data/planets/mercury" }, "Venus::Path"), |
1249
|
|
|
|
|
|
|
# bless({ value => "t/data/planets/neptune" }, "Venus::Path"), |
1250
|
|
|
|
|
|
|
# bless({ value => "t/data/planets/planet9" }, "Venus::Path"), |
1251
|
|
|
|
|
|
|
# bless({ value => "t/data/planets/pluto" }, "Venus::Path"), |
1252
|
|
|
|
|
|
|
# bless({ value => "t/data/planets/saturn" }, "Venus::Path"), |
1253
|
|
|
|
|
|
|
# bless({ value => "t/data/planets/uranus" }, "Venus::Path"), |
1254
|
|
|
|
|
|
|
# bless({ value => "t/data/planets/venus" }, "Venus::Path"), |
1255
|
|
|
|
|
|
|
# ] |
1256
|
|
|
|
|
|
|
|
1257
|
|
|
|
|
|
|
=back |
1258
|
|
|
|
|
|
|
|
1259
|
|
|
|
|
|
|
=over 4 |
1260
|
|
|
|
|
|
|
|
1261
|
|
|
|
|
|
|
=item find example 2 |
1262
|
|
|
|
|
|
|
|
1263
|
|
|
|
|
|
|
# given: synopsis; |
1264
|
|
|
|
|
|
|
|
1265
|
|
|
|
|
|
|
my $find = $path->find('[:\/\\\.]+m[^:\/\\\.]*$'); |
1266
|
|
|
|
|
|
|
|
1267
|
|
|
|
|
|
|
# [ |
1268
|
|
|
|
|
|
|
# bless({ value => "t/data/planets/makemake" }, "Venus::Path"), |
1269
|
|
|
|
|
|
|
# bless({ value => "t/data/planets/mars" }, "Venus::Path"), |
1270
|
|
|
|
|
|
|
# bless({ value => "t/data/planets/mercury" }, "Venus::Path"), |
1271
|
|
|
|
|
|
|
# ] |
1272
|
|
|
|
|
|
|
|
1273
|
|
|
|
|
|
|
=back |
1274
|
|
|
|
|
|
|
|
1275
|
|
|
|
|
|
|
=over 4 |
1276
|
|
|
|
|
|
|
|
1277
|
|
|
|
|
|
|
=item find example 3 |
1278
|
|
|
|
|
|
|
|
1279
|
|
|
|
|
|
|
# given: synopsis; |
1280
|
|
|
|
|
|
|
|
1281
|
|
|
|
|
|
|
my $find = $path->find('earth'); |
1282
|
|
|
|
|
|
|
|
1283
|
|
|
|
|
|
|
# [ |
1284
|
|
|
|
|
|
|
# bless({ value => "t/data/planets/earth" }, "Venus::Path"), |
1285
|
|
|
|
|
|
|
# ] |
1286
|
|
|
|
|
|
|
|
1287
|
|
|
|
|
|
|
=back |
1288
|
|
|
|
|
|
|
|
1289
|
|
|
|
|
|
|
=cut |
1290
|
|
|
|
|
|
|
|
1291
|
|
|
|
|
|
|
=head2 glob |
1292
|
|
|
|
|
|
|
|
1293
|
|
|
|
|
|
|
glob(Str | Regexp $expr) (ArrayRef[Path]) |
1294
|
|
|
|
|
|
|
|
1295
|
|
|
|
|
|
|
The glob method returns the files and directories under the path matching the |
1296
|
|
|
|
|
|
|
expression provided, which defaults to C<*>. This method can return a list of |
1297
|
|
|
|
|
|
|
values in list-context. |
1298
|
|
|
|
|
|
|
|
1299
|
|
|
|
|
|
|
I> |
1300
|
|
|
|
|
|
|
|
1301
|
|
|
|
|
|
|
=over 4 |
1302
|
|
|
|
|
|
|
|
1303
|
|
|
|
|
|
|
=item glob example 1 |
1304
|
|
|
|
|
|
|
|
1305
|
|
|
|
|
|
|
# given: synopsis; |
1306
|
|
|
|
|
|
|
|
1307
|
|
|
|
|
|
|
my $glob = $path->glob; |
1308
|
|
|
|
|
|
|
|
1309
|
|
|
|
|
|
|
# [ |
1310
|
|
|
|
|
|
|
# bless({ value => "t/data/planets/ceres" }, "Venus::Path"), |
1311
|
|
|
|
|
|
|
# bless({ value => "t/data/planets/earth" }, "Venus::Path"), |
1312
|
|
|
|
|
|
|
# bless({ value => "t/data/planets/eris" }, "Venus::Path"), |
1313
|
|
|
|
|
|
|
# bless({ value => "t/data/planets/haumea" }, "Venus::Path"), |
1314
|
|
|
|
|
|
|
# bless({ value => "t/data/planets/jupiter" }, "Venus::Path"), |
1315
|
|
|
|
|
|
|
# bless({ value => "t/data/planets/makemake" }, "Venus::Path"), |
1316
|
|
|
|
|
|
|
# bless({ value => "t/data/planets/mars" }, "Venus::Path"), |
1317
|
|
|
|
|
|
|
# bless({ value => "t/data/planets/mercury" }, "Venus::Path"), |
1318
|
|
|
|
|
|
|
# bless({ value => "t/data/planets/neptune" }, "Venus::Path"), |
1319
|
|
|
|
|
|
|
# bless({ value => "t/data/planets/planet9" }, "Venus::Path"), |
1320
|
|
|
|
|
|
|
# bless({ value => "t/data/planets/pluto" }, "Venus::Path"), |
1321
|
|
|
|
|
|
|
# bless({ value => "t/data/planets/saturn" }, "Venus::Path"), |
1322
|
|
|
|
|
|
|
# bless({ value => "t/data/planets/uranus" }, "Venus::Path"), |
1323
|
|
|
|
|
|
|
# bless({ value => "t/data/planets/venus" }, "Venus::Path"), |
1324
|
|
|
|
|
|
|
# ] |
1325
|
|
|
|
|
|
|
|
1326
|
|
|
|
|
|
|
=back |
1327
|
|
|
|
|
|
|
|
1328
|
|
|
|
|
|
|
=cut |
1329
|
|
|
|
|
|
|
|
1330
|
|
|
|
|
|
|
=head2 is_absolute |
1331
|
|
|
|
|
|
|
|
1332
|
|
|
|
|
|
|
is_absolute() (Bool) |
1333
|
|
|
|
|
|
|
|
1334
|
|
|
|
|
|
|
The is_absolute method returns truthy or falsy is the path is absolute. |
1335
|
|
|
|
|
|
|
|
1336
|
|
|
|
|
|
|
I> |
1337
|
|
|
|
|
|
|
|
1338
|
|
|
|
|
|
|
=over 4 |
1339
|
|
|
|
|
|
|
|
1340
|
|
|
|
|
|
|
=item is_absolute example 1 |
1341
|
|
|
|
|
|
|
|
1342
|
|
|
|
|
|
|
# given: synopsis; |
1343
|
|
|
|
|
|
|
|
1344
|
|
|
|
|
|
|
my $is_absolute = $path->is_absolute; |
1345
|
|
|
|
|
|
|
|
1346
|
|
|
|
|
|
|
# 0 |
1347
|
|
|
|
|
|
|
|
1348
|
|
|
|
|
|
|
=back |
1349
|
|
|
|
|
|
|
|
1350
|
|
|
|
|
|
|
=cut |
1351
|
|
|
|
|
|
|
|
1352
|
|
|
|
|
|
|
=head2 is_directory |
1353
|
|
|
|
|
|
|
|
1354
|
|
|
|
|
|
|
is_directory() (Bool) |
1355
|
|
|
|
|
|
|
|
1356
|
|
|
|
|
|
|
The is_directory method returns truthy or falsy is the path is a directory. |
1357
|
|
|
|
|
|
|
|
1358
|
|
|
|
|
|
|
I> |
1359
|
|
|
|
|
|
|
|
1360
|
|
|
|
|
|
|
=over 4 |
1361
|
|
|
|
|
|
|
|
1362
|
|
|
|
|
|
|
=item is_directory example 1 |
1363
|
|
|
|
|
|
|
|
1364
|
|
|
|
|
|
|
# given: synopsis; |
1365
|
|
|
|
|
|
|
|
1366
|
|
|
|
|
|
|
my $is_directory = $path->is_directory; |
1367
|
|
|
|
|
|
|
|
1368
|
|
|
|
|
|
|
# 1 |
1369
|
|
|
|
|
|
|
|
1370
|
|
|
|
|
|
|
=back |
1371
|
|
|
|
|
|
|
|
1372
|
|
|
|
|
|
|
=cut |
1373
|
|
|
|
|
|
|
|
1374
|
|
|
|
|
|
|
=head2 is_file |
1375
|
|
|
|
|
|
|
|
1376
|
|
|
|
|
|
|
is_file() (Bool) |
1377
|
|
|
|
|
|
|
|
1378
|
|
|
|
|
|
|
The is_file method returns truthy or falsy is the path is a file. |
1379
|
|
|
|
|
|
|
|
1380
|
|
|
|
|
|
|
I> |
1381
|
|
|
|
|
|
|
|
1382
|
|
|
|
|
|
|
=over 4 |
1383
|
|
|
|
|
|
|
|
1384
|
|
|
|
|
|
|
=item is_file example 1 |
1385
|
|
|
|
|
|
|
|
1386
|
|
|
|
|
|
|
# given: synopsis; |
1387
|
|
|
|
|
|
|
|
1388
|
|
|
|
|
|
|
my $is_file = $path->is_file; |
1389
|
|
|
|
|
|
|
|
1390
|
|
|
|
|
|
|
# 0 |
1391
|
|
|
|
|
|
|
|
1392
|
|
|
|
|
|
|
=back |
1393
|
|
|
|
|
|
|
|
1394
|
|
|
|
|
|
|
=cut |
1395
|
|
|
|
|
|
|
|
1396
|
|
|
|
|
|
|
=head2 is_relative |
1397
|
|
|
|
|
|
|
|
1398
|
|
|
|
|
|
|
is_relative() (Bool) |
1399
|
|
|
|
|
|
|
|
1400
|
|
|
|
|
|
|
The is_relative method returns truthy or falsy is the path is relative. |
1401
|
|
|
|
|
|
|
|
1402
|
|
|
|
|
|
|
I> |
1403
|
|
|
|
|
|
|
|
1404
|
|
|
|
|
|
|
=over 4 |
1405
|
|
|
|
|
|
|
|
1406
|
|
|
|
|
|
|
=item is_relative example 1 |
1407
|
|
|
|
|
|
|
|
1408
|
|
|
|
|
|
|
# given: synopsis; |
1409
|
|
|
|
|
|
|
|
1410
|
|
|
|
|
|
|
my $is_relative = $path->is_relative; |
1411
|
|
|
|
|
|
|
|
1412
|
|
|
|
|
|
|
# 1 |
1413
|
|
|
|
|
|
|
|
1414
|
|
|
|
|
|
|
=back |
1415
|
|
|
|
|
|
|
|
1416
|
|
|
|
|
|
|
=cut |
1417
|
|
|
|
|
|
|
|
1418
|
|
|
|
|
|
|
=head2 lineage |
1419
|
|
|
|
|
|
|
|
1420
|
|
|
|
|
|
|
lineage() (ArrayRef[Path]) |
1421
|
|
|
|
|
|
|
|
1422
|
|
|
|
|
|
|
The lineage method returns the list of parent paths up to the root path. This |
1423
|
|
|
|
|
|
|
method can return a list of values in list-context. |
1424
|
|
|
|
|
|
|
|
1425
|
|
|
|
|
|
|
I> |
1426
|
|
|
|
|
|
|
|
1427
|
|
|
|
|
|
|
=over 4 |
1428
|
|
|
|
|
|
|
|
1429
|
|
|
|
|
|
|
=item lineage example 1 |
1430
|
|
|
|
|
|
|
|
1431
|
|
|
|
|
|
|
# given: synopsis; |
1432
|
|
|
|
|
|
|
|
1433
|
|
|
|
|
|
|
my $lineage = $path->lineage; |
1434
|
|
|
|
|
|
|
|
1435
|
|
|
|
|
|
|
# [ |
1436
|
|
|
|
|
|
|
# bless({ value => "t/data/planets" }, "Venus::Path"), |
1437
|
|
|
|
|
|
|
# bless({ value => "t/data" }, "Venus::Path"), |
1438
|
|
|
|
|
|
|
# bless({ value => "t" }, "Venus::Path"), |
1439
|
|
|
|
|
|
|
# ] |
1440
|
|
|
|
|
|
|
|
1441
|
|
|
|
|
|
|
=back |
1442
|
|
|
|
|
|
|
|
1443
|
|
|
|
|
|
|
=cut |
1444
|
|
|
|
|
|
|
|
1445
|
|
|
|
|
|
|
=head2 lines |
1446
|
|
|
|
|
|
|
|
1447
|
|
|
|
|
|
|
lines(Str|Regexp $separator, Str $binmode) (ArrayRef[Str]) |
1448
|
|
|
|
|
|
|
|
1449
|
|
|
|
|
|
|
The lines method returns the list of lines from the underlying file. By default |
1450
|
|
|
|
|
|
|
the file contents are separated by newline. |
1451
|
|
|
|
|
|
|
|
1452
|
|
|
|
|
|
|
I> |
1453
|
|
|
|
|
|
|
|
1454
|
|
|
|
|
|
|
=over 4 |
1455
|
|
|
|
|
|
|
|
1456
|
|
|
|
|
|
|
=item lines example 1 |
1457
|
|
|
|
|
|
|
|
1458
|
|
|
|
|
|
|
# given: synopsis; |
1459
|
|
|
|
|
|
|
|
1460
|
|
|
|
|
|
|
my $lines = $path->child('mercury')->lines; |
1461
|
|
|
|
|
|
|
|
1462
|
|
|
|
|
|
|
# ['mercury'] |
1463
|
|
|
|
|
|
|
|
1464
|
|
|
|
|
|
|
=back |
1465
|
|
|
|
|
|
|
|
1466
|
|
|
|
|
|
|
=over 4 |
1467
|
|
|
|
|
|
|
|
1468
|
|
|
|
|
|
|
=item lines example 2 |
1469
|
|
|
|
|
|
|
|
1470
|
|
|
|
|
|
|
# given: synopsis; |
1471
|
|
|
|
|
|
|
|
1472
|
|
|
|
|
|
|
my $lines = $path->child('planet9')->lines($^O =~ /win32/i ? "\n" : "\r\n"); |
1473
|
|
|
|
|
|
|
|
1474
|
|
|
|
|
|
|
# ['planet', 'nine'] |
1475
|
|
|
|
|
|
|
|
1476
|
|
|
|
|
|
|
=back |
1477
|
|
|
|
|
|
|
|
1478
|
|
|
|
|
|
|
=cut |
1479
|
|
|
|
|
|
|
|
1480
|
|
|
|
|
|
|
=head2 mkcall |
1481
|
|
|
|
|
|
|
|
1482
|
|
|
|
|
|
|
mkcall(Any @data) (Any) |
1483
|
|
|
|
|
|
|
|
1484
|
|
|
|
|
|
|
The mkcall method returns the result of executing the path as an executable. In |
1485
|
|
|
|
|
|
|
list context returns the call output and exit code. |
1486
|
|
|
|
|
|
|
|
1487
|
|
|
|
|
|
|
I> |
1488
|
|
|
|
|
|
|
|
1489
|
|
|
|
|
|
|
=over 4 |
1490
|
|
|
|
|
|
|
|
1491
|
|
|
|
|
|
|
=item mkcall example 1 |
1492
|
|
|
|
|
|
|
|
1493
|
|
|
|
|
|
|
package main; |
1494
|
|
|
|
|
|
|
|
1495
|
|
|
|
|
|
|
use Venus::Path; |
1496
|
|
|
|
|
|
|
|
1497
|
|
|
|
|
|
|
my $path = Venus::Path->new($^X); |
1498
|
|
|
|
|
|
|
|
1499
|
|
|
|
|
|
|
my $output = $path->mkcall('--help'); |
1500
|
|
|
|
|
|
|
|
1501
|
|
|
|
|
|
|
# Usage: perl ... |
1502
|
|
|
|
|
|
|
|
1503
|
|
|
|
|
|
|
=back |
1504
|
|
|
|
|
|
|
|
1505
|
|
|
|
|
|
|
=over 4 |
1506
|
|
|
|
|
|
|
|
1507
|
|
|
|
|
|
|
=item mkcall example 2 |
1508
|
|
|
|
|
|
|
|
1509
|
|
|
|
|
|
|
package main; |
1510
|
|
|
|
|
|
|
|
1511
|
|
|
|
|
|
|
use Venus::Path; |
1512
|
|
|
|
|
|
|
|
1513
|
|
|
|
|
|
|
my $path = Venus::Path->new($^X); |
1514
|
|
|
|
|
|
|
|
1515
|
|
|
|
|
|
|
my ($call_output, $exit_code) = $path->mkcall('t/data/sun', '--heat-death'); |
1516
|
|
|
|
|
|
|
|
1517
|
|
|
|
|
|
|
# ("", 1) |
1518
|
|
|
|
|
|
|
|
1519
|
|
|
|
|
|
|
=back |
1520
|
|
|
|
|
|
|
|
1521
|
|
|
|
|
|
|
=over 4 |
1522
|
|
|
|
|
|
|
|
1523
|
|
|
|
|
|
|
=item mkcall example 3 |
1524
|
|
|
|
|
|
|
|
1525
|
|
|
|
|
|
|
package main; |
1526
|
|
|
|
|
|
|
|
1527
|
|
|
|
|
|
|
use Venus::Path; |
1528
|
|
|
|
|
|
|
|
1529
|
|
|
|
|
|
|
my $path = Venus::Path->new('.help'); |
1530
|
|
|
|
|
|
|
|
1531
|
|
|
|
|
|
|
my $output = $path->mkcall; |
1532
|
|
|
|
|
|
|
|
1533
|
|
|
|
|
|
|
# Exception! (isa Venus::Path::Error) (see error_on_mkcall) |
1534
|
|
|
|
|
|
|
|
1535
|
|
|
|
|
|
|
=back |
1536
|
|
|
|
|
|
|
|
1537
|
|
|
|
|
|
|
=cut |
1538
|
|
|
|
|
|
|
|
1539
|
|
|
|
|
|
|
=head2 mkdir |
1540
|
|
|
|
|
|
|
|
1541
|
|
|
|
|
|
|
mkdir(Maybe[Str] $mode) (Path) |
1542
|
|
|
|
|
|
|
|
1543
|
|
|
|
|
|
|
The mkdir method makes the path as a directory. |
1544
|
|
|
|
|
|
|
|
1545
|
|
|
|
|
|
|
I> |
1546
|
|
|
|
|
|
|
|
1547
|
|
|
|
|
|
|
=over 4 |
1548
|
|
|
|
|
|
|
|
1549
|
|
|
|
|
|
|
=item mkdir example 1 |
1550
|
|
|
|
|
|
|
|
1551
|
|
|
|
|
|
|
package main; |
1552
|
|
|
|
|
|
|
|
1553
|
|
|
|
|
|
|
use Venus::Path; |
1554
|
|
|
|
|
|
|
|
1555
|
|
|
|
|
|
|
my $path = Venus::Path->new('t/data/systems'); |
1556
|
|
|
|
|
|
|
|
1557
|
|
|
|
|
|
|
$path = $path->mkdir; |
1558
|
|
|
|
|
|
|
|
1559
|
|
|
|
|
|
|
# bless({ value => "t/data/systems" }, "Venus::Path") |
1560
|
|
|
|
|
|
|
|
1561
|
|
|
|
|
|
|
=back |
1562
|
|
|
|
|
|
|
|
1563
|
|
|
|
|
|
|
=over 4 |
1564
|
|
|
|
|
|
|
|
1565
|
|
|
|
|
|
|
=item mkdir example 2 |
1566
|
|
|
|
|
|
|
|
1567
|
|
|
|
|
|
|
package main; |
1568
|
|
|
|
|
|
|
|
1569
|
|
|
|
|
|
|
use Venus::Path; |
1570
|
|
|
|
|
|
|
|
1571
|
|
|
|
|
|
|
my $path = Venus::Path->new('/path/to/xyz'); |
1572
|
|
|
|
|
|
|
|
1573
|
|
|
|
|
|
|
$path = $path->mkdir; |
1574
|
|
|
|
|
|
|
|
1575
|
|
|
|
|
|
|
# Exception! (isa Venus::Path::Error) (see error_on_mkdir) |
1576
|
|
|
|
|
|
|
|
1577
|
|
|
|
|
|
|
=back |
1578
|
|
|
|
|
|
|
|
1579
|
|
|
|
|
|
|
=cut |
1580
|
|
|
|
|
|
|
|
1581
|
|
|
|
|
|
|
=head2 mkdirs |
1582
|
|
|
|
|
|
|
|
1583
|
|
|
|
|
|
|
mkdirs(Maybe[Str] $mode) (ArrayRef[Path]) |
1584
|
|
|
|
|
|
|
|
1585
|
|
|
|
|
|
|
The mkdirs method creates parent directories and returns the list of created |
1586
|
|
|
|
|
|
|
directories. This method can return a list of values in list-context. |
1587
|
|
|
|
|
|
|
|
1588
|
|
|
|
|
|
|
I> |
1589
|
|
|
|
|
|
|
|
1590
|
|
|
|
|
|
|
=over 4 |
1591
|
|
|
|
|
|
|
|
1592
|
|
|
|
|
|
|
=item mkdirs example 1 |
1593
|
|
|
|
|
|
|
|
1594
|
|
|
|
|
|
|
package main; |
1595
|
|
|
|
|
|
|
|
1596
|
|
|
|
|
|
|
use Venus::Path; |
1597
|
|
|
|
|
|
|
|
1598
|
|
|
|
|
|
|
my $path = Venus::Path->new('t/data/systems'); |
1599
|
|
|
|
|
|
|
|
1600
|
|
|
|
|
|
|
my $mkdirs = $path->mkdirs; |
1601
|
|
|
|
|
|
|
|
1602
|
|
|
|
|
|
|
# [ |
1603
|
|
|
|
|
|
|
# bless({ value => "t/data/systems" }, "Venus::Path") |
1604
|
|
|
|
|
|
|
# ] |
1605
|
|
|
|
|
|
|
|
1606
|
|
|
|
|
|
|
=back |
1607
|
|
|
|
|
|
|
|
1608
|
|
|
|
|
|
|
=over 4 |
1609
|
|
|
|
|
|
|
|
1610
|
|
|
|
|
|
|
=item mkdirs example 2 |
1611
|
|
|
|
|
|
|
|
1612
|
|
|
|
|
|
|
package main; |
1613
|
|
|
|
|
|
|
|
1614
|
|
|
|
|
|
|
use Venus::Path; |
1615
|
|
|
|
|
|
|
|
1616
|
|
|
|
|
|
|
my $path = Venus::Path->new('t/data/systems/solar'); |
1617
|
|
|
|
|
|
|
|
1618
|
|
|
|
|
|
|
my $mkdirs = $path->mkdirs; |
1619
|
|
|
|
|
|
|
|
1620
|
|
|
|
|
|
|
# [ |
1621
|
|
|
|
|
|
|
# bless({ value => "t/data/systems" }, "Venus::Path"), |
1622
|
|
|
|
|
|
|
# bless({ value => "t/data/systems/solar" }, "Venus::Path"), |
1623
|
|
|
|
|
|
|
# ] |
1624
|
|
|
|
|
|
|
|
1625
|
|
|
|
|
|
|
=back |
1626
|
|
|
|
|
|
|
|
1627
|
|
|
|
|
|
|
=cut |
1628
|
|
|
|
|
|
|
|
1629
|
|
|
|
|
|
|
=head2 mkfile |
1630
|
|
|
|
|
|
|
|
1631
|
|
|
|
|
|
|
mkfile() (Path) |
1632
|
|
|
|
|
|
|
|
1633
|
|
|
|
|
|
|
The mkfile method makes the path as an empty file. |
1634
|
|
|
|
|
|
|
|
1635
|
|
|
|
|
|
|
I> |
1636
|
|
|
|
|
|
|
|
1637
|
|
|
|
|
|
|
=over 4 |
1638
|
|
|
|
|
|
|
|
1639
|
|
|
|
|
|
|
=item mkfile example 1 |
1640
|
|
|
|
|
|
|
|
1641
|
|
|
|
|
|
|
package main; |
1642
|
|
|
|
|
|
|
|
1643
|
|
|
|
|
|
|
use Venus::Path; |
1644
|
|
|
|
|
|
|
|
1645
|
|
|
|
|
|
|
my $path = Venus::Path->new('t/data/moon'); |
1646
|
|
|
|
|
|
|
|
1647
|
|
|
|
|
|
|
$path = $path->mkfile; |
1648
|
|
|
|
|
|
|
|
1649
|
|
|
|
|
|
|
# bless({ value => "t/data/moon" }, "Venus::Path") |
1650
|
|
|
|
|
|
|
|
1651
|
|
|
|
|
|
|
=back |
1652
|
|
|
|
|
|
|
|
1653
|
|
|
|
|
|
|
=over 4 |
1654
|
|
|
|
|
|
|
|
1655
|
|
|
|
|
|
|
=item mkfile example 2 |
1656
|
|
|
|
|
|
|
|
1657
|
|
|
|
|
|
|
package main; |
1658
|
|
|
|
|
|
|
|
1659
|
|
|
|
|
|
|
use Venus::Path; |
1660
|
|
|
|
|
|
|
|
1661
|
|
|
|
|
|
|
my $path = Venus::Path->new('/path/to/xyz'); |
1662
|
|
|
|
|
|
|
|
1663
|
|
|
|
|
|
|
$path = $path->mkfile; |
1664
|
|
|
|
|
|
|
|
1665
|
|
|
|
|
|
|
# Exception! (isa Venus::Path::Error) (see error_on_mkfile) |
1666
|
|
|
|
|
|
|
|
1667
|
|
|
|
|
|
|
=back |
1668
|
|
|
|
|
|
|
|
1669
|
|
|
|
|
|
|
=cut |
1670
|
|
|
|
|
|
|
|
1671
|
|
|
|
|
|
|
=head2 mktemp_dir |
1672
|
|
|
|
|
|
|
|
1673
|
|
|
|
|
|
|
mktemp_dir() (Path) |
1674
|
|
|
|
|
|
|
|
1675
|
|
|
|
|
|
|
The mktemp_dir method uses L to create a temporary |
1676
|
|
|
|
|
|
|
directory which isn't automatically removed and returns a new path object. |
1677
|
|
|
|
|
|
|
|
1678
|
|
|
|
|
|
|
I> |
1679
|
|
|
|
|
|
|
|
1680
|
|
|
|
|
|
|
=over 4 |
1681
|
|
|
|
|
|
|
|
1682
|
|
|
|
|
|
|
=item mktemp_dir example 1 |
1683
|
|
|
|
|
|
|
|
1684
|
|
|
|
|
|
|
# given: synopsis |
1685
|
|
|
|
|
|
|
|
1686
|
|
|
|
|
|
|
package main; |
1687
|
|
|
|
|
|
|
|
1688
|
|
|
|
|
|
|
my $mktemp_dir = $path->mktemp_dir; |
1689
|
|
|
|
|
|
|
|
1690
|
|
|
|
|
|
|
# bless({value => "/tmp/ZnKTxBpuBE"}, "Venus::Path") |
1691
|
|
|
|
|
|
|
|
1692
|
|
|
|
|
|
|
=back |
1693
|
|
|
|
|
|
|
|
1694
|
|
|
|
|
|
|
=cut |
1695
|
|
|
|
|
|
|
|
1696
|
|
|
|
|
|
|
=head2 mktemp_file |
1697
|
|
|
|
|
|
|
|
1698
|
|
|
|
|
|
|
mktemp_file() (Path) |
1699
|
|
|
|
|
|
|
|
1700
|
|
|
|
|
|
|
The mktemp_file method uses L to create a temporary file |
1701
|
|
|
|
|
|
|
which isn't automatically removed and returns a new path object. |
1702
|
|
|
|
|
|
|
|
1703
|
|
|
|
|
|
|
I> |
1704
|
|
|
|
|
|
|
|
1705
|
|
|
|
|
|
|
=over 4 |
1706
|
|
|
|
|
|
|
|
1707
|
|
|
|
|
|
|
=item mktemp_file example 1 |
1708
|
|
|
|
|
|
|
|
1709
|
|
|
|
|
|
|
# given: synopsis |
1710
|
|
|
|
|
|
|
|
1711
|
|
|
|
|
|
|
package main; |
1712
|
|
|
|
|
|
|
|
1713
|
|
|
|
|
|
|
my $mktemp_file = $path->mktemp_file; |
1714
|
|
|
|
|
|
|
|
1715
|
|
|
|
|
|
|
# bless({value => "/tmp/y5MvliBQ2F"}, "Venus::Path") |
1716
|
|
|
|
|
|
|
|
1717
|
|
|
|
|
|
|
=back |
1718
|
|
|
|
|
|
|
|
1719
|
|
|
|
|
|
|
=cut |
1720
|
|
|
|
|
|
|
|
1721
|
|
|
|
|
|
|
=head2 move |
1722
|
|
|
|
|
|
|
|
1723
|
|
|
|
|
|
|
move(Str | Path $path) (Path) |
1724
|
|
|
|
|
|
|
|
1725
|
|
|
|
|
|
|
The move method uses L to move the file represented by the |
1726
|
|
|
|
|
|
|
invocant to the path provided and returns the invocant. |
1727
|
|
|
|
|
|
|
|
1728
|
|
|
|
|
|
|
I> |
1729
|
|
|
|
|
|
|
|
1730
|
|
|
|
|
|
|
=over 4 |
1731
|
|
|
|
|
|
|
|
1732
|
|
|
|
|
|
|
=item move example 1 |
1733
|
|
|
|
|
|
|
|
1734
|
|
|
|
|
|
|
package main; |
1735
|
|
|
|
|
|
|
|
1736
|
|
|
|
|
|
|
use Venus::Path; |
1737
|
|
|
|
|
|
|
|
1738
|
|
|
|
|
|
|
my $path = Venus::Path->new('t/data'); |
1739
|
|
|
|
|
|
|
|
1740
|
|
|
|
|
|
|
my $unknown = $path->child('unknown')->mkfile->move($path->child('titan')); |
1741
|
|
|
|
|
|
|
|
1742
|
|
|
|
|
|
|
# bless({value => 't/data/titan'}, 'Venus::Path') |
1743
|
|
|
|
|
|
|
|
1744
|
|
|
|
|
|
|
=back |
1745
|
|
|
|
|
|
|
|
1746
|
|
|
|
|
|
|
=cut |
1747
|
|
|
|
|
|
|
|
1748
|
|
|
|
|
|
|
=head2 name |
1749
|
|
|
|
|
|
|
|
1750
|
|
|
|
|
|
|
name() (Str) |
1751
|
|
|
|
|
|
|
|
1752
|
|
|
|
|
|
|
The name method returns the path as an absolute path. |
1753
|
|
|
|
|
|
|
|
1754
|
|
|
|
|
|
|
I> |
1755
|
|
|
|
|
|
|
|
1756
|
|
|
|
|
|
|
=over 4 |
1757
|
|
|
|
|
|
|
|
1758
|
|
|
|
|
|
|
=item name example 1 |
1759
|
|
|
|
|
|
|
|
1760
|
|
|
|
|
|
|
# given: synopsis; |
1761
|
|
|
|
|
|
|
|
1762
|
|
|
|
|
|
|
my $name = $path->name; |
1763
|
|
|
|
|
|
|
|
1764
|
|
|
|
|
|
|
# /path/to/t/data/planets |
1765
|
|
|
|
|
|
|
|
1766
|
|
|
|
|
|
|
=back |
1767
|
|
|
|
|
|
|
|
1768
|
|
|
|
|
|
|
=cut |
1769
|
|
|
|
|
|
|
|
1770
|
|
|
|
|
|
|
=head2 open |
1771
|
|
|
|
|
|
|
|
1772
|
|
|
|
|
|
|
open(Any @data) (FileHandle) |
1773
|
|
|
|
|
|
|
|
1774
|
|
|
|
|
|
|
The open method creates and returns an open filehandle. |
1775
|
|
|
|
|
|
|
|
1776
|
|
|
|
|
|
|
I> |
1777
|
|
|
|
|
|
|
|
1778
|
|
|
|
|
|
|
=over 4 |
1779
|
|
|
|
|
|
|
|
1780
|
|
|
|
|
|
|
=item open example 1 |
1781
|
|
|
|
|
|
|
|
1782
|
|
|
|
|
|
|
package main; |
1783
|
|
|
|
|
|
|
|
1784
|
|
|
|
|
|
|
use Venus::Path; |
1785
|
|
|
|
|
|
|
|
1786
|
|
|
|
|
|
|
my $path = Venus::Path->new('t/data/planets/earth'); |
1787
|
|
|
|
|
|
|
|
1788
|
|
|
|
|
|
|
my $fh = $path->open; |
1789
|
|
|
|
|
|
|
|
1790
|
|
|
|
|
|
|
# bless(..., "IO::File"); |
1791
|
|
|
|
|
|
|
|
1792
|
|
|
|
|
|
|
=back |
1793
|
|
|
|
|
|
|
|
1794
|
|
|
|
|
|
|
=over 4 |
1795
|
|
|
|
|
|
|
|
1796
|
|
|
|
|
|
|
=item open example 2 |
1797
|
|
|
|
|
|
|
|
1798
|
|
|
|
|
|
|
package main; |
1799
|
|
|
|
|
|
|
|
1800
|
|
|
|
|
|
|
use Venus::Path; |
1801
|
|
|
|
|
|
|
|
1802
|
|
|
|
|
|
|
my $path = Venus::Path->new('t/data/planets/earth'); |
1803
|
|
|
|
|
|
|
|
1804
|
|
|
|
|
|
|
my $fh = $path->open('<'); |
1805
|
|
|
|
|
|
|
|
1806
|
|
|
|
|
|
|
# bless(..., "IO::File"); |
1807
|
|
|
|
|
|
|
|
1808
|
|
|
|
|
|
|
=back |
1809
|
|
|
|
|
|
|
|
1810
|
|
|
|
|
|
|
=over 4 |
1811
|
|
|
|
|
|
|
|
1812
|
|
|
|
|
|
|
=item open example 3 |
1813
|
|
|
|
|
|
|
|
1814
|
|
|
|
|
|
|
package main; |
1815
|
|
|
|
|
|
|
|
1816
|
|
|
|
|
|
|
use Venus::Path; |
1817
|
|
|
|
|
|
|
|
1818
|
|
|
|
|
|
|
my $path = Venus::Path->new('t/data/planets/earth'); |
1819
|
|
|
|
|
|
|
|
1820
|
|
|
|
|
|
|
my $fh = $path->open('>'); |
1821
|
|
|
|
|
|
|
|
1822
|
|
|
|
|
|
|
# bless(..., "IO::File"); |
1823
|
|
|
|
|
|
|
|
1824
|
|
|
|
|
|
|
=back |
1825
|
|
|
|
|
|
|
|
1826
|
|
|
|
|
|
|
=over 4 |
1827
|
|
|
|
|
|
|
|
1828
|
|
|
|
|
|
|
=item open example 4 |
1829
|
|
|
|
|
|
|
|
1830
|
|
|
|
|
|
|
package main; |
1831
|
|
|
|
|
|
|
|
1832
|
|
|
|
|
|
|
use Venus::Path; |
1833
|
|
|
|
|
|
|
|
1834
|
|
|
|
|
|
|
my $path = Venus::Path->new('/path/to/xyz'); |
1835
|
|
|
|
|
|
|
|
1836
|
|
|
|
|
|
|
my $fh = $path->open('>'); |
1837
|
|
|
|
|
|
|
|
1838
|
|
|
|
|
|
|
# Exception! (isa Venus::Path::Error) (see error_on_open) |
1839
|
|
|
|
|
|
|
|
1840
|
|
|
|
|
|
|
=back |
1841
|
|
|
|
|
|
|
|
1842
|
|
|
|
|
|
|
=cut |
1843
|
|
|
|
|
|
|
|
1844
|
|
|
|
|
|
|
=head2 parent |
1845
|
|
|
|
|
|
|
|
1846
|
|
|
|
|
|
|
parent() (Path) |
1847
|
|
|
|
|
|
|
|
1848
|
|
|
|
|
|
|
The parent method returns a path object representing the parent directory. |
1849
|
|
|
|
|
|
|
|
1850
|
|
|
|
|
|
|
I> |
1851
|
|
|
|
|
|
|
|
1852
|
|
|
|
|
|
|
=over 4 |
1853
|
|
|
|
|
|
|
|
1854
|
|
|
|
|
|
|
=item parent example 1 |
1855
|
|
|
|
|
|
|
|
1856
|
|
|
|
|
|
|
# given: synopsis; |
1857
|
|
|
|
|
|
|
|
1858
|
|
|
|
|
|
|
my $parent = $path->parent; |
1859
|
|
|
|
|
|
|
|
1860
|
|
|
|
|
|
|
# bless({ value => "t/data" }, "Venus::Path") |
1861
|
|
|
|
|
|
|
|
1862
|
|
|
|
|
|
|
=back |
1863
|
|
|
|
|
|
|
|
1864
|
|
|
|
|
|
|
=cut |
1865
|
|
|
|
|
|
|
|
1866
|
|
|
|
|
|
|
=head2 parents |
1867
|
|
|
|
|
|
|
|
1868
|
|
|
|
|
|
|
parents() (ArrayRef[Path]) |
1869
|
|
|
|
|
|
|
|
1870
|
|
|
|
|
|
|
The parents method returns is a list of parent directories. This method can |
1871
|
|
|
|
|
|
|
return a list of values in list-context. |
1872
|
|
|
|
|
|
|
|
1873
|
|
|
|
|
|
|
I> |
1874
|
|
|
|
|
|
|
|
1875
|
|
|
|
|
|
|
=over 4 |
1876
|
|
|
|
|
|
|
|
1877
|
|
|
|
|
|
|
=item parents example 1 |
1878
|
|
|
|
|
|
|
|
1879
|
|
|
|
|
|
|
# given: synopsis; |
1880
|
|
|
|
|
|
|
|
1881
|
|
|
|
|
|
|
my $parents = $path->parents; |
1882
|
|
|
|
|
|
|
|
1883
|
|
|
|
|
|
|
# [ |
1884
|
|
|
|
|
|
|
# bless({ value => "t/data" }, "Venus::Path"), |
1885
|
|
|
|
|
|
|
# bless({ value => "t" }, "Venus::Path"), |
1886
|
|
|
|
|
|
|
# ] |
1887
|
|
|
|
|
|
|
|
1888
|
|
|
|
|
|
|
=back |
1889
|
|
|
|
|
|
|
|
1890
|
|
|
|
|
|
|
=cut |
1891
|
|
|
|
|
|
|
|
1892
|
|
|
|
|
|
|
=head2 parts |
1893
|
|
|
|
|
|
|
|
1894
|
|
|
|
|
|
|
parts() (ArrayRef[Str]) |
1895
|
|
|
|
|
|
|
|
1896
|
|
|
|
|
|
|
The parts method returns an arrayref of path parts. |
1897
|
|
|
|
|
|
|
|
1898
|
|
|
|
|
|
|
I> |
1899
|
|
|
|
|
|
|
|
1900
|
|
|
|
|
|
|
=over 4 |
1901
|
|
|
|
|
|
|
|
1902
|
|
|
|
|
|
|
=item parts example 1 |
1903
|
|
|
|
|
|
|
|
1904
|
|
|
|
|
|
|
# given: synopsis; |
1905
|
|
|
|
|
|
|
|
1906
|
|
|
|
|
|
|
my $parts = $path->parts; |
1907
|
|
|
|
|
|
|
|
1908
|
|
|
|
|
|
|
# ["t", "data", "planets"] |
1909
|
|
|
|
|
|
|
|
1910
|
|
|
|
|
|
|
=back |
1911
|
|
|
|
|
|
|
|
1912
|
|
|
|
|
|
|
=cut |
1913
|
|
|
|
|
|
|
|
1914
|
|
|
|
|
|
|
=head2 read |
1915
|
|
|
|
|
|
|
|
1916
|
|
|
|
|
|
|
read(Str $binmode) (Str) |
1917
|
|
|
|
|
|
|
|
1918
|
|
|
|
|
|
|
The read method reads the file and returns its contents. |
1919
|
|
|
|
|
|
|
|
1920
|
|
|
|
|
|
|
I> |
1921
|
|
|
|
|
|
|
|
1922
|
|
|
|
|
|
|
=over 4 |
1923
|
|
|
|
|
|
|
|
1924
|
|
|
|
|
|
|
=item read example 1 |
1925
|
|
|
|
|
|
|
|
1926
|
|
|
|
|
|
|
package main; |
1927
|
|
|
|
|
|
|
|
1928
|
|
|
|
|
|
|
use Venus::Path; |
1929
|
|
|
|
|
|
|
|
1930
|
|
|
|
|
|
|
my $path = Venus::Path->new('t/data/planets/mars'); |
1931
|
|
|
|
|
|
|
|
1932
|
|
|
|
|
|
|
my $content = $path->read; |
1933
|
|
|
|
|
|
|
|
1934
|
|
|
|
|
|
|
=back |
1935
|
|
|
|
|
|
|
|
1936
|
|
|
|
|
|
|
=over 4 |
1937
|
|
|
|
|
|
|
|
1938
|
|
|
|
|
|
|
=item read example 2 |
1939
|
|
|
|
|
|
|
|
1940
|
|
|
|
|
|
|
package main; |
1941
|
|
|
|
|
|
|
|
1942
|
|
|
|
|
|
|
use Venus::Path; |
1943
|
|
|
|
|
|
|
|
1944
|
|
|
|
|
|
|
my $path = Venus::Path->new('/path/to/xyz'); |
1945
|
|
|
|
|
|
|
|
1946
|
|
|
|
|
|
|
my $content = $path->read; |
1947
|
|
|
|
|
|
|
|
1948
|
|
|
|
|
|
|
# Exception! (isa Venus::Path::Error) (see error_on_read_open) |
1949
|
|
|
|
|
|
|
|
1950
|
|
|
|
|
|
|
=back |
1951
|
|
|
|
|
|
|
|
1952
|
|
|
|
|
|
|
=cut |
1953
|
|
|
|
|
|
|
|
1954
|
|
|
|
|
|
|
=head2 relative |
1955
|
|
|
|
|
|
|
|
1956
|
|
|
|
|
|
|
relative(Str $root) (Path) |
1957
|
|
|
|
|
|
|
|
1958
|
|
|
|
|
|
|
The relative method returns a path object representing a relative path |
1959
|
|
|
|
|
|
|
(relative to the path provided). |
1960
|
|
|
|
|
|
|
|
1961
|
|
|
|
|
|
|
I> |
1962
|
|
|
|
|
|
|
|
1963
|
|
|
|
|
|
|
=over 4 |
1964
|
|
|
|
|
|
|
|
1965
|
|
|
|
|
|
|
=item relative example 1 |
1966
|
|
|
|
|
|
|
|
1967
|
|
|
|
|
|
|
package main; |
1968
|
|
|
|
|
|
|
|
1969
|
|
|
|
|
|
|
use Venus::Path; |
1970
|
|
|
|
|
|
|
|
1971
|
|
|
|
|
|
|
my $path = Venus::Path->new('/path/to/t/data/planets/mars'); |
1972
|
|
|
|
|
|
|
|
1973
|
|
|
|
|
|
|
my $relative = $path->relative('/path'); |
1974
|
|
|
|
|
|
|
|
1975
|
|
|
|
|
|
|
# bless({ value => "to/t/data/planets/mars" }, "Venus::Path") |
1976
|
|
|
|
|
|
|
|
1977
|
|
|
|
|
|
|
=back |
1978
|
|
|
|
|
|
|
|
1979
|
|
|
|
|
|
|
=over 4 |
1980
|
|
|
|
|
|
|
|
1981
|
|
|
|
|
|
|
=item relative example 2 |
1982
|
|
|
|
|
|
|
|
1983
|
|
|
|
|
|
|
package main; |
1984
|
|
|
|
|
|
|
|
1985
|
|
|
|
|
|
|
use Venus::Path; |
1986
|
|
|
|
|
|
|
|
1987
|
|
|
|
|
|
|
my $path = Venus::Path->new('/path/to/t/data/planets/mars'); |
1988
|
|
|
|
|
|
|
|
1989
|
|
|
|
|
|
|
my $relative = $path->relative('/path/to/t'); |
1990
|
|
|
|
|
|
|
|
1991
|
|
|
|
|
|
|
# bless({ value => "data/planets/mars" }, "Venus::Path") |
1992
|
|
|
|
|
|
|
|
1993
|
|
|
|
|
|
|
=back |
1994
|
|
|
|
|
|
|
|
1995
|
|
|
|
|
|
|
=cut |
1996
|
|
|
|
|
|
|
|
1997
|
|
|
|
|
|
|
=head2 rename |
1998
|
|
|
|
|
|
|
|
1999
|
|
|
|
|
|
|
rename(Str | Path $path) (Path) |
2000
|
|
|
|
|
|
|
|
2001
|
|
|
|
|
|
|
The rename method performs a L unless the path provided is only a file |
2002
|
|
|
|
|
|
|
name, in which case it attempts a rename under the directory of the invocant. |
2003
|
|
|
|
|
|
|
|
2004
|
|
|
|
|
|
|
I> |
2005
|
|
|
|
|
|
|
|
2006
|
|
|
|
|
|
|
=over 4 |
2007
|
|
|
|
|
|
|
|
2008
|
|
|
|
|
|
|
=item rename example 1 |
2009
|
|
|
|
|
|
|
|
2010
|
|
|
|
|
|
|
package main; |
2011
|
|
|
|
|
|
|
|
2012
|
|
|
|
|
|
|
use Venus::Path; |
2013
|
|
|
|
|
|
|
|
2014
|
|
|
|
|
|
|
my $path = Venus::Path->new('t/path/001'); |
2015
|
|
|
|
|
|
|
|
2016
|
|
|
|
|
|
|
my $rename = $path->rename('002'); |
2017
|
|
|
|
|
|
|
|
2018
|
|
|
|
|
|
|
# bless({value => 't/path/002'}, 'Venus::Path') |
2019
|
|
|
|
|
|
|
|
2020
|
|
|
|
|
|
|
=back |
2021
|
|
|
|
|
|
|
|
2022
|
|
|
|
|
|
|
=cut |
2023
|
|
|
|
|
|
|
|
2024
|
|
|
|
|
|
|
=head2 rmdir |
2025
|
|
|
|
|
|
|
|
2026
|
|
|
|
|
|
|
rmdir() (Path) |
2027
|
|
|
|
|
|
|
|
2028
|
|
|
|
|
|
|
The rmdir method removes the directory and returns a path object representing |
2029
|
|
|
|
|
|
|
the deleted directory. |
2030
|
|
|
|
|
|
|
|
2031
|
|
|
|
|
|
|
I> |
2032
|
|
|
|
|
|
|
|
2033
|
|
|
|
|
|
|
=over 4 |
2034
|
|
|
|
|
|
|
|
2035
|
|
|
|
|
|
|
=item rmdir example 1 |
2036
|
|
|
|
|
|
|
|
2037
|
|
|
|
|
|
|
package main; |
2038
|
|
|
|
|
|
|
|
2039
|
|
|
|
|
|
|
use Venus::Path; |
2040
|
|
|
|
|
|
|
|
2041
|
|
|
|
|
|
|
my $path = Venus::Path->new('t/data/stars'); |
2042
|
|
|
|
|
|
|
|
2043
|
|
|
|
|
|
|
my $rmdir = $path->mkdir->rmdir; |
2044
|
|
|
|
|
|
|
|
2045
|
|
|
|
|
|
|
# bless({ value => "t/data/stars" }, "Venus::Path") |
2046
|
|
|
|
|
|
|
|
2047
|
|
|
|
|
|
|
=back |
2048
|
|
|
|
|
|
|
|
2049
|
|
|
|
|
|
|
=over 4 |
2050
|
|
|
|
|
|
|
|
2051
|
|
|
|
|
|
|
=item rmdir example 2 |
2052
|
|
|
|
|
|
|
|
2053
|
|
|
|
|
|
|
package main; |
2054
|
|
|
|
|
|
|
|
2055
|
|
|
|
|
|
|
use Venus::Path; |
2056
|
|
|
|
|
|
|
|
2057
|
|
|
|
|
|
|
my $path = Venus::Path->new('/path/to/xyz'); |
2058
|
|
|
|
|
|
|
|
2059
|
|
|
|
|
|
|
my $rmdir = $path->mkdir->rmdir; |
2060
|
|
|
|
|
|
|
|
2061
|
|
|
|
|
|
|
# Exception! (isa Venus::Path::Error) (see error_on_rmdir) |
2062
|
|
|
|
|
|
|
|
2063
|
|
|
|
|
|
|
=back |
2064
|
|
|
|
|
|
|
|
2065
|
|
|
|
|
|
|
=cut |
2066
|
|
|
|
|
|
|
|
2067
|
|
|
|
|
|
|
=head2 rmdirs |
2068
|
|
|
|
|
|
|
|
2069
|
|
|
|
|
|
|
rmdirs() (ArrayRef[Path]) |
2070
|
|
|
|
|
|
|
|
2071
|
|
|
|
|
|
|
The rmdirs method removes that path and its child files and directories and |
2072
|
|
|
|
|
|
|
returns all paths removed. This method can return a list of values in |
2073
|
|
|
|
|
|
|
list-context. |
2074
|
|
|
|
|
|
|
|
2075
|
|
|
|
|
|
|
I> |
2076
|
|
|
|
|
|
|
|
2077
|
|
|
|
|
|
|
=over 4 |
2078
|
|
|
|
|
|
|
|
2079
|
|
|
|
|
|
|
=item rmdirs example 1 |
2080
|
|
|
|
|
|
|
|
2081
|
|
|
|
|
|
|
package main; |
2082
|
|
|
|
|
|
|
|
2083
|
|
|
|
|
|
|
use Venus::Path; |
2084
|
|
|
|
|
|
|
|
2085
|
|
|
|
|
|
|
my $path = Venus::Path->new('t/data/stars'); |
2086
|
|
|
|
|
|
|
|
2087
|
|
|
|
|
|
|
$path->child('dwarfs')->mkdirs; |
2088
|
|
|
|
|
|
|
|
2089
|
|
|
|
|
|
|
my $rmdirs = $path->rmdirs; |
2090
|
|
|
|
|
|
|
|
2091
|
|
|
|
|
|
|
# [ |
2092
|
|
|
|
|
|
|
# bless({ value => "t/data/stars/dwarfs" }, "Venus::Path"), |
2093
|
|
|
|
|
|
|
# bless({ value => "t/data/stars" }, "Venus::Path"), |
2094
|
|
|
|
|
|
|
# ] |
2095
|
|
|
|
|
|
|
|
2096
|
|
|
|
|
|
|
=back |
2097
|
|
|
|
|
|
|
|
2098
|
|
|
|
|
|
|
=cut |
2099
|
|
|
|
|
|
|
|
2100
|
|
|
|
|
|
|
=head2 rmfiles |
2101
|
|
|
|
|
|
|
|
2102
|
|
|
|
|
|
|
rmfiles() (ArrayRef[Path]) |
2103
|
|
|
|
|
|
|
|
2104
|
|
|
|
|
|
|
The rmfiles method recursively removes files under the path and returns the |
2105
|
|
|
|
|
|
|
paths removed. This method does not remove the directories found. This method |
2106
|
|
|
|
|
|
|
can return a list of values in list-context. |
2107
|
|
|
|
|
|
|
|
2108
|
|
|
|
|
|
|
I> |
2109
|
|
|
|
|
|
|
|
2110
|
|
|
|
|
|
|
=over 4 |
2111
|
|
|
|
|
|
|
|
2112
|
|
|
|
|
|
|
=item rmfiles example 1 |
2113
|
|
|
|
|
|
|
|
2114
|
|
|
|
|
|
|
package main; |
2115
|
|
|
|
|
|
|
|
2116
|
|
|
|
|
|
|
use Venus::Path; |
2117
|
|
|
|
|
|
|
|
2118
|
|
|
|
|
|
|
my $path = Venus::Path->new('t/data/stars')->mkdir; |
2119
|
|
|
|
|
|
|
|
2120
|
|
|
|
|
|
|
$path->child('sirius')->mkfile; |
2121
|
|
|
|
|
|
|
$path->child('canopus')->mkfile; |
2122
|
|
|
|
|
|
|
$path->child('arcturus')->mkfile; |
2123
|
|
|
|
|
|
|
$path->child('vega')->mkfile; |
2124
|
|
|
|
|
|
|
$path->child('capella')->mkfile; |
2125
|
|
|
|
|
|
|
|
2126
|
|
|
|
|
|
|
my $rmfiles = $path->rmfiles; |
2127
|
|
|
|
|
|
|
|
2128
|
|
|
|
|
|
|
# [ |
2129
|
|
|
|
|
|
|
# bless({ value => "t/data/stars/arcturus" }, "Venus::Path"), |
2130
|
|
|
|
|
|
|
# bless({ value => "t/data/stars/canopus" }, "Venus::Path"), |
2131
|
|
|
|
|
|
|
# bless({ value => "t/data/stars/capella" }, "Venus::Path"), |
2132
|
|
|
|
|
|
|
# bless({ value => "t/data/stars/sirius" }, "Venus::Path"), |
2133
|
|
|
|
|
|
|
# bless({ value => "t/data/stars/vega" }, "Venus::Path"), |
2134
|
|
|
|
|
|
|
# ] |
2135
|
|
|
|
|
|
|
|
2136
|
|
|
|
|
|
|
=back |
2137
|
|
|
|
|
|
|
|
2138
|
|
|
|
|
|
|
=cut |
2139
|
|
|
|
|
|
|
|
2140
|
|
|
|
|
|
|
=head2 root |
2141
|
|
|
|
|
|
|
|
2142
|
|
|
|
|
|
|
root(Str $spec, Str $base) (Maybe[Path]) |
2143
|
|
|
|
|
|
|
|
2144
|
|
|
|
|
|
|
The root method performs a search up the file system heirarchy returns the |
2145
|
|
|
|
|
|
|
first path (i.e. absolute path) matching the file test specification and base |
2146
|
|
|
|
|
|
|
path expression provided. The file test specification is the same passed to |
2147
|
|
|
|
|
|
|
L. If no path matches are found this method returns underfined. |
2148
|
|
|
|
|
|
|
|
2149
|
|
|
|
|
|
|
I> |
2150
|
|
|
|
|
|
|
|
2151
|
|
|
|
|
|
|
=over 4 |
2152
|
|
|
|
|
|
|
|
2153
|
|
|
|
|
|
|
=item root example 1 |
2154
|
|
|
|
|
|
|
|
2155
|
|
|
|
|
|
|
# given: synopsis; |
2156
|
|
|
|
|
|
|
|
2157
|
|
|
|
|
|
|
my $root = $path->root('d', 't'); |
2158
|
|
|
|
|
|
|
|
2159
|
|
|
|
|
|
|
# bless({ value => "/path/to/t/../" }, "Venus::Path") |
2160
|
|
|
|
|
|
|
|
2161
|
|
|
|
|
|
|
=back |
2162
|
|
|
|
|
|
|
|
2163
|
|
|
|
|
|
|
=over 4 |
2164
|
|
|
|
|
|
|
|
2165
|
|
|
|
|
|
|
=item root example 2 |
2166
|
|
|
|
|
|
|
|
2167
|
|
|
|
|
|
|
# given: synopsis; |
2168
|
|
|
|
|
|
|
|
2169
|
|
|
|
|
|
|
my $root = $path->root('f', 't'); |
2170
|
|
|
|
|
|
|
|
2171
|
|
|
|
|
|
|
# undef |
2172
|
|
|
|
|
|
|
|
2173
|
|
|
|
|
|
|
=back |
2174
|
|
|
|
|
|
|
|
2175
|
|
|
|
|
|
|
=cut |
2176
|
|
|
|
|
|
|
|
2177
|
|
|
|
|
|
|
=head2 seek |
2178
|
|
|
|
|
|
|
|
2179
|
|
|
|
|
|
|
seek(Str $spec, Str $base) (Maybe[Path]) |
2180
|
|
|
|
|
|
|
|
2181
|
|
|
|
|
|
|
The seek method performs a search down the file system heirarchy returns the |
2182
|
|
|
|
|
|
|
first path (i.e. absolute path) matching the file test specification and base |
2183
|
|
|
|
|
|
|
path expression provided. The file test specification is the same passed to |
2184
|
|
|
|
|
|
|
L. If no path matches are found this method returns underfined. |
2185
|
|
|
|
|
|
|
|
2186
|
|
|
|
|
|
|
I> |
2187
|
|
|
|
|
|
|
|
2188
|
|
|
|
|
|
|
=over 4 |
2189
|
|
|
|
|
|
|
|
2190
|
|
|
|
|
|
|
=item seek example 1 |
2191
|
|
|
|
|
|
|
|
2192
|
|
|
|
|
|
|
# given: synopsis; |
2193
|
|
|
|
|
|
|
|
2194
|
|
|
|
|
|
|
$path = Venus::Path->new('t'); |
2195
|
|
|
|
|
|
|
|
2196
|
|
|
|
|
|
|
my $seek = $path->seek('f', 'earth'); |
2197
|
|
|
|
|
|
|
|
2198
|
|
|
|
|
|
|
# bless({ value => "/path/to/t/data/planets/earth" }, "Venus::Path") |
2199
|
|
|
|
|
|
|
|
2200
|
|
|
|
|
|
|
=back |
2201
|
|
|
|
|
|
|
|
2202
|
|
|
|
|
|
|
=over 4 |
2203
|
|
|
|
|
|
|
|
2204
|
|
|
|
|
|
|
=item seek example 2 |
2205
|
|
|
|
|
|
|
|
2206
|
|
|
|
|
|
|
# given: synopsis; |
2207
|
|
|
|
|
|
|
|
2208
|
|
|
|
|
|
|
$path = Venus::Path->new('t'); |
2209
|
|
|
|
|
|
|
|
2210
|
|
|
|
|
|
|
my $seek = $path->seek('f', 'europa'); |
2211
|
|
|
|
|
|
|
|
2212
|
|
|
|
|
|
|
# undef |
2213
|
|
|
|
|
|
|
|
2214
|
|
|
|
|
|
|
=back |
2215
|
|
|
|
|
|
|
|
2216
|
|
|
|
|
|
|
=cut |
2217
|
|
|
|
|
|
|
|
2218
|
|
|
|
|
|
|
=head2 sibling |
2219
|
|
|
|
|
|
|
|
2220
|
|
|
|
|
|
|
sibling(Str $path) (Path) |
2221
|
|
|
|
|
|
|
|
2222
|
|
|
|
|
|
|
The sibling method returns a path object representing the sibling path provided. |
2223
|
|
|
|
|
|
|
|
2224
|
|
|
|
|
|
|
I> |
2225
|
|
|
|
|
|
|
|
2226
|
|
|
|
|
|
|
=over 4 |
2227
|
|
|
|
|
|
|
|
2228
|
|
|
|
|
|
|
=item sibling example 1 |
2229
|
|
|
|
|
|
|
|
2230
|
|
|
|
|
|
|
# given: synopsis; |
2231
|
|
|
|
|
|
|
|
2232
|
|
|
|
|
|
|
my $sibling = $path->sibling('galaxies'); |
2233
|
|
|
|
|
|
|
|
2234
|
|
|
|
|
|
|
# bless({ value => "t/data/galaxies" }, "Venus::Path") |
2235
|
|
|
|
|
|
|
|
2236
|
|
|
|
|
|
|
=back |
2237
|
|
|
|
|
|
|
|
2238
|
|
|
|
|
|
|
=cut |
2239
|
|
|
|
|
|
|
|
2240
|
|
|
|
|
|
|
=head2 siblings |
2241
|
|
|
|
|
|
|
|
2242
|
|
|
|
|
|
|
siblings() (ArrayRef[Path]) |
2243
|
|
|
|
|
|
|
|
2244
|
|
|
|
|
|
|
The siblings method returns all sibling files and directories for the current |
2245
|
|
|
|
|
|
|
path. This method can return a list of values in list-context. |
2246
|
|
|
|
|
|
|
|
2247
|
|
|
|
|
|
|
I> |
2248
|
|
|
|
|
|
|
|
2249
|
|
|
|
|
|
|
=over 4 |
2250
|
|
|
|
|
|
|
|
2251
|
|
|
|
|
|
|
=item siblings example 1 |
2252
|
|
|
|
|
|
|
|
2253
|
|
|
|
|
|
|
# given: synopsis; |
2254
|
|
|
|
|
|
|
|
2255
|
|
|
|
|
|
|
my $siblings = $path->siblings; |
2256
|
|
|
|
|
|
|
|
2257
|
|
|
|
|
|
|
# [ |
2258
|
|
|
|
|
|
|
# bless({ value => "t/data/moon" }, "Venus::Path"), |
2259
|
|
|
|
|
|
|
# bless({ value => "t/data/sun" }, "Venus::Path"), |
2260
|
|
|
|
|
|
|
# ] |
2261
|
|
|
|
|
|
|
|
2262
|
|
|
|
|
|
|
=back |
2263
|
|
|
|
|
|
|
|
2264
|
|
|
|
|
|
|
=cut |
2265
|
|
|
|
|
|
|
|
2266
|
|
|
|
|
|
|
=head2 test |
2267
|
|
|
|
|
|
|
|
2268
|
|
|
|
|
|
|
test(Str $expr) (Bool) |
2269
|
|
|
|
|
|
|
|
2270
|
|
|
|
|
|
|
The test method evaluates the current path against the stackable file test |
2271
|
|
|
|
|
|
|
operators provided. |
2272
|
|
|
|
|
|
|
|
2273
|
|
|
|
|
|
|
I> |
2274
|
|
|
|
|
|
|
|
2275
|
|
|
|
|
|
|
=over 4 |
2276
|
|
|
|
|
|
|
|
2277
|
|
|
|
|
|
|
=item test example 1 |
2278
|
|
|
|
|
|
|
|
2279
|
|
|
|
|
|
|
# given: synopsis; |
2280
|
|
|
|
|
|
|
|
2281
|
|
|
|
|
|
|
my $test = $path->test; |
2282
|
|
|
|
|
|
|
|
2283
|
|
|
|
|
|
|
# -e $path |
2284
|
|
|
|
|
|
|
|
2285
|
|
|
|
|
|
|
# 1 |
2286
|
|
|
|
|
|
|
|
2287
|
|
|
|
|
|
|
=back |
2288
|
|
|
|
|
|
|
|
2289
|
|
|
|
|
|
|
=over 4 |
2290
|
|
|
|
|
|
|
|
2291
|
|
|
|
|
|
|
=item test example 2 |
2292
|
|
|
|
|
|
|
|
2293
|
|
|
|
|
|
|
package main; |
2294
|
|
|
|
|
|
|
|
2295
|
|
|
|
|
|
|
use Venus::Path; |
2296
|
|
|
|
|
|
|
|
2297
|
|
|
|
|
|
|
my $path = Venus::Path->new('t/data/sun'); |
2298
|
|
|
|
|
|
|
|
2299
|
|
|
|
|
|
|
my $test = $path->test('efs'); |
2300
|
|
|
|
|
|
|
|
2301
|
|
|
|
|
|
|
# -e -f -s $path |
2302
|
|
|
|
|
|
|
|
2303
|
|
|
|
|
|
|
# 1 |
2304
|
|
|
|
|
|
|
|
2305
|
|
|
|
|
|
|
=back |
2306
|
|
|
|
|
|
|
|
2307
|
|
|
|
|
|
|
=cut |
2308
|
|
|
|
|
|
|
|
2309
|
|
|
|
|
|
|
=head2 unlink |
2310
|
|
|
|
|
|
|
|
2311
|
|
|
|
|
|
|
unlink() (Path) |
2312
|
|
|
|
|
|
|
|
2313
|
|
|
|
|
|
|
The unlink method removes the file and returns a path object representing the |
2314
|
|
|
|
|
|
|
removed file. |
2315
|
|
|
|
|
|
|
|
2316
|
|
|
|
|
|
|
I> |
2317
|
|
|
|
|
|
|
|
2318
|
|
|
|
|
|
|
=over 4 |
2319
|
|
|
|
|
|
|
|
2320
|
|
|
|
|
|
|
=item unlink example 1 |
2321
|
|
|
|
|
|
|
|
2322
|
|
|
|
|
|
|
package main; |
2323
|
|
|
|
|
|
|
|
2324
|
|
|
|
|
|
|
use Venus::Path; |
2325
|
|
|
|
|
|
|
|
2326
|
|
|
|
|
|
|
my $path = Venus::Path->new('t/data/asteroid')->mkfile; |
2327
|
|
|
|
|
|
|
|
2328
|
|
|
|
|
|
|
my $unlink = $path->unlink; |
2329
|
|
|
|
|
|
|
|
2330
|
|
|
|
|
|
|
# bless({ value => "t/data/asteroid" }, "Venus::Path") |
2331
|
|
|
|
|
|
|
|
2332
|
|
|
|
|
|
|
=back |
2333
|
|
|
|
|
|
|
|
2334
|
|
|
|
|
|
|
=over 4 |
2335
|
|
|
|
|
|
|
|
2336
|
|
|
|
|
|
|
=item unlink example 2 |
2337
|
|
|
|
|
|
|
|
2338
|
|
|
|
|
|
|
package main; |
2339
|
|
|
|
|
|
|
|
2340
|
|
|
|
|
|
|
use Venus::Path; |
2341
|
|
|
|
|
|
|
|
2342
|
|
|
|
|
|
|
my $path = Venus::Path->new('/path/to/xyz'); |
2343
|
|
|
|
|
|
|
|
2344
|
|
|
|
|
|
|
my $unlink = $path->unlink; |
2345
|
|
|
|
|
|
|
|
2346
|
|
|
|
|
|
|
# Exception! (isa Venus::Path::Error) (see error_on_unlink) |
2347
|
|
|
|
|
|
|
|
2348
|
|
|
|
|
|
|
=back |
2349
|
|
|
|
|
|
|
|
2350
|
|
|
|
|
|
|
=cut |
2351
|
|
|
|
|
|
|
|
2352
|
|
|
|
|
|
|
=head2 write |
2353
|
|
|
|
|
|
|
|
2354
|
|
|
|
|
|
|
write(Str $data, Str $binmode) (Path) |
2355
|
|
|
|
|
|
|
|
2356
|
|
|
|
|
|
|
The write method write the data provided to the file. |
2357
|
|
|
|
|
|
|
|
2358
|
|
|
|
|
|
|
I> |
2359
|
|
|
|
|
|
|
|
2360
|
|
|
|
|
|
|
=over 4 |
2361
|
|
|
|
|
|
|
|
2362
|
|
|
|
|
|
|
=item write example 1 |
2363
|
|
|
|
|
|
|
|
2364
|
|
|
|
|
|
|
package main; |
2365
|
|
|
|
|
|
|
|
2366
|
|
|
|
|
|
|
use Venus::Path; |
2367
|
|
|
|
|
|
|
|
2368
|
|
|
|
|
|
|
my $path = Venus::Path->new('t/data/asteroid'); |
2369
|
|
|
|
|
|
|
|
2370
|
|
|
|
|
|
|
my $write = $path->write('asteroid'); |
2371
|
|
|
|
|
|
|
|
2372
|
|
|
|
|
|
|
=back |
2373
|
|
|
|
|
|
|
|
2374
|
|
|
|
|
|
|
=over 4 |
2375
|
|
|
|
|
|
|
|
2376
|
|
|
|
|
|
|
=item write example 2 |
2377
|
|
|
|
|
|
|
|
2378
|
|
|
|
|
|
|
package main; |
2379
|
|
|
|
|
|
|
|
2380
|
|
|
|
|
|
|
use Venus::Path; |
2381
|
|
|
|
|
|
|
|
2382
|
|
|
|
|
|
|
my $path = Venus::Path->new('/path/to/xyz'); |
2383
|
|
|
|
|
|
|
|
2384
|
|
|
|
|
|
|
my $write = $path->write('nothing'); |
2385
|
|
|
|
|
|
|
|
2386
|
|
|
|
|
|
|
# Exception! (isa Venus::Path::Error) (see error_on_write_open) |
2387
|
|
|
|
|
|
|
|
2388
|
|
|
|
|
|
|
=back |
2389
|
|
|
|
|
|
|
|
2390
|
|
|
|
|
|
|
=cut |
2391
|
|
|
|
|
|
|
|
2392
|
|
|
|
|
|
|
=head1 ERRORS |
2393
|
|
|
|
|
|
|
|
2394
|
|
|
|
|
|
|
This package may raise the following errors: |
2395
|
|
|
|
|
|
|
|
2396
|
|
|
|
|
|
|
=cut |
2397
|
|
|
|
|
|
|
|
2398
|
|
|
|
|
|
|
=over 4 |
2399
|
|
|
|
|
|
|
|
2400
|
|
|
|
|
|
|
=item error: C |
2401
|
|
|
|
|
|
|
|
2402
|
|
|
|
|
|
|
This package may raise an error_on_copy exception. |
2403
|
|
|
|
|
|
|
|
2404
|
|
|
|
|
|
|
B |
2405
|
|
|
|
|
|
|
|
2406
|
|
|
|
|
|
|
# given: synopsis; |
2407
|
|
|
|
|
|
|
|
2408
|
|
|
|
|
|
|
my @args = ("/nowhere"); |
2409
|
|
|
|
|
|
|
|
2410
|
|
|
|
|
|
|
my $error = $path->throw('error_on_copy', @args)->catch('error'); |
2411
|
|
|
|
|
|
|
|
2412
|
|
|
|
|
|
|
# my $name = $error->name; |
2413
|
|
|
|
|
|
|
|
2414
|
|
|
|
|
|
|
# "on_copy" |
2415
|
|
|
|
|
|
|
|
2416
|
|
|
|
|
|
|
# my $message = $error->message; |
2417
|
|
|
|
|
|
|
|
2418
|
|
|
|
|
|
|
# "Can't copy \"t\/data\/planets\" to \"/nowhere\": $!" |
2419
|
|
|
|
|
|
|
|
2420
|
|
|
|
|
|
|
# my $path = $error->stash('path'); |
2421
|
|
|
|
|
|
|
|
2422
|
|
|
|
|
|
|
# "/nowhere" |
2423
|
|
|
|
|
|
|
|
2424
|
|
|
|
|
|
|
# my $self = $error->stash('self'); |
2425
|
|
|
|
|
|
|
|
2426
|
|
|
|
|
|
|
# bless({...}, 'Venus::Path') |
2427
|
|
|
|
|
|
|
|
2428
|
|
|
|
|
|
|
=back |
2429
|
|
|
|
|
|
|
|
2430
|
|
|
|
|
|
|
=over 4 |
2431
|
|
|
|
|
|
|
|
2432
|
|
|
|
|
|
|
=item error: C |
2433
|
|
|
|
|
|
|
|
2434
|
|
|
|
|
|
|
This package may raise an error_on_mkcall exception. |
2435
|
|
|
|
|
|
|
|
2436
|
|
|
|
|
|
|
B |
2437
|
|
|
|
|
|
|
|
2438
|
|
|
|
|
|
|
# given: synopsis; |
2439
|
|
|
|
|
|
|
|
2440
|
|
|
|
|
|
|
my @args = ("/nowhere"); |
2441
|
|
|
|
|
|
|
|
2442
|
|
|
|
|
|
|
my $error = $path->throw('error_on_mkcall', @args)->catch('error'); |
2443
|
|
|
|
|
|
|
|
2444
|
|
|
|
|
|
|
# my $name = $error->name; |
2445
|
|
|
|
|
|
|
|
2446
|
|
|
|
|
|
|
# "on_mkcall" |
2447
|
|
|
|
|
|
|
|
2448
|
|
|
|
|
|
|
# my $message = $error->message; |
2449
|
|
|
|
|
|
|
|
2450
|
|
|
|
|
|
|
# "Can't make system call to \"/nowhere\": $!" |
2451
|
|
|
|
|
|
|
|
2452
|
|
|
|
|
|
|
# my $path = $error->stash('path'); |
2453
|
|
|
|
|
|
|
|
2454
|
|
|
|
|
|
|
# "/nowhere" |
2455
|
|
|
|
|
|
|
|
2456
|
|
|
|
|
|
|
=back |
2457
|
|
|
|
|
|
|
|
2458
|
|
|
|
|
|
|
=over 4 |
2459
|
|
|
|
|
|
|
|
2460
|
|
|
|
|
|
|
=item error: C |
2461
|
|
|
|
|
|
|
|
2462
|
|
|
|
|
|
|
This package may raise an error_on_mkdir exception. |
2463
|
|
|
|
|
|
|
|
2464
|
|
|
|
|
|
|
B |
2465
|
|
|
|
|
|
|
|
2466
|
|
|
|
|
|
|
# given: synopsis; |
2467
|
|
|
|
|
|
|
|
2468
|
|
|
|
|
|
|
my @args = ("/nowhere"); |
2469
|
|
|
|
|
|
|
|
2470
|
|
|
|
|
|
|
my $error = $path->throw('error_on_mkdir', @args)->catch('error'); |
2471
|
|
|
|
|
|
|
|
2472
|
|
|
|
|
|
|
# my $name = $error->name; |
2473
|
|
|
|
|
|
|
|
2474
|
|
|
|
|
|
|
# "on_mkdir" |
2475
|
|
|
|
|
|
|
|
2476
|
|
|
|
|
|
|
# my $message = $error->message; |
2477
|
|
|
|
|
|
|
|
2478
|
|
|
|
|
|
|
# "Can't make directory \"/nowhere\": $!" |
2479
|
|
|
|
|
|
|
|
2480
|
|
|
|
|
|
|
# my $path = $error->stash('path'); |
2481
|
|
|
|
|
|
|
|
2482
|
|
|
|
|
|
|
# "/nowhere" |
2483
|
|
|
|
|
|
|
|
2484
|
|
|
|
|
|
|
=back |
2485
|
|
|
|
|
|
|
|
2486
|
|
|
|
|
|
|
=over 4 |
2487
|
|
|
|
|
|
|
|
2488
|
|
|
|
|
|
|
=item error: C |
2489
|
|
|
|
|
|
|
|
2490
|
|
|
|
|
|
|
This package may raise an error_on_mkfile exception. |
2491
|
|
|
|
|
|
|
|
2492
|
|
|
|
|
|
|
B |
2493
|
|
|
|
|
|
|
|
2494
|
|
|
|
|
|
|
# given: synopsis; |
2495
|
|
|
|
|
|
|
|
2496
|
|
|
|
|
|
|
my @args = ("/nowhere"); |
2497
|
|
|
|
|
|
|
|
2498
|
|
|
|
|
|
|
my $error = $path->throw('error_on_mkfile', @args)->catch('error'); |
2499
|
|
|
|
|
|
|
|
2500
|
|
|
|
|
|
|
# my $name = $error->name; |
2501
|
|
|
|
|
|
|
|
2502
|
|
|
|
|
|
|
# "on_mkfile" |
2503
|
|
|
|
|
|
|
|
2504
|
|
|
|
|
|
|
# my $message = $error->message; |
2505
|
|
|
|
|
|
|
|
2506
|
|
|
|
|
|
|
# "Can't make file \"/nowhere\": $!" |
2507
|
|
|
|
|
|
|
|
2508
|
|
|
|
|
|
|
# my $path = $error->stash('path'); |
2509
|
|
|
|
|
|
|
|
2510
|
|
|
|
|
|
|
# "/nowhere" |
2511
|
|
|
|
|
|
|
|
2512
|
|
|
|
|
|
|
=back |
2513
|
|
|
|
|
|
|
|
2514
|
|
|
|
|
|
|
=over 4 |
2515
|
|
|
|
|
|
|
|
2516
|
|
|
|
|
|
|
=item error: C |
2517
|
|
|
|
|
|
|
|
2518
|
|
|
|
|
|
|
This package may raise an error_on_move exception. |
2519
|
|
|
|
|
|
|
|
2520
|
|
|
|
|
|
|
B |
2521
|
|
|
|
|
|
|
|
2522
|
|
|
|
|
|
|
# given: synopsis; |
2523
|
|
|
|
|
|
|
|
2524
|
|
|
|
|
|
|
my @args = ("/nowhere"); |
2525
|
|
|
|
|
|
|
|
2526
|
|
|
|
|
|
|
my $error = $path->throw('error_on_move', @args)->catch('error'); |
2527
|
|
|
|
|
|
|
|
2528
|
|
|
|
|
|
|
# my $name = $error->name; |
2529
|
|
|
|
|
|
|
|
2530
|
|
|
|
|
|
|
# "on_move" |
2531
|
|
|
|
|
|
|
|
2532
|
|
|
|
|
|
|
# my $message = $error->message; |
2533
|
|
|
|
|
|
|
|
2534
|
|
|
|
|
|
|
# "Can't copy \"t\/data\/planets\" to \"/nowhere\": $!" |
2535
|
|
|
|
|
|
|
|
2536
|
|
|
|
|
|
|
# my $path = $error->stash('path'); |
2537
|
|
|
|
|
|
|
|
2538
|
|
|
|
|
|
|
# "/nowhere" |
2539
|
|
|
|
|
|
|
|
2540
|
|
|
|
|
|
|
# my $self = $error->stash('self'); |
2541
|
|
|
|
|
|
|
|
2542
|
|
|
|
|
|
|
# bless({...}, 'Venus::Path') |
2543
|
|
|
|
|
|
|
|
2544
|
|
|
|
|
|
|
=back |
2545
|
|
|
|
|
|
|
|
2546
|
|
|
|
|
|
|
=over 4 |
2547
|
|
|
|
|
|
|
|
2548
|
|
|
|
|
|
|
=item error: C |
2549
|
|
|
|
|
|
|
|
2550
|
|
|
|
|
|
|
This package may raise an error_on_open exception. |
2551
|
|
|
|
|
|
|
|
2552
|
|
|
|
|
|
|
B |
2553
|
|
|
|
|
|
|
|
2554
|
|
|
|
|
|
|
# given: synopsis; |
2555
|
|
|
|
|
|
|
|
2556
|
|
|
|
|
|
|
my @args = ("/nowhere"); |
2557
|
|
|
|
|
|
|
|
2558
|
|
|
|
|
|
|
my $error = $path->throw('error_on_open', @args)->catch('error'); |
2559
|
|
|
|
|
|
|
|
2560
|
|
|
|
|
|
|
# my $name = $error->name; |
2561
|
|
|
|
|
|
|
|
2562
|
|
|
|
|
|
|
# "on_open" |
2563
|
|
|
|
|
|
|
|
2564
|
|
|
|
|
|
|
# my $message = $error->message; |
2565
|
|
|
|
|
|
|
|
2566
|
|
|
|
|
|
|
# "Can't open \"/nowhere\": $!" |
2567
|
|
|
|
|
|
|
|
2568
|
|
|
|
|
|
|
# my $path = $error->stash('path'); |
2569
|
|
|
|
|
|
|
|
2570
|
|
|
|
|
|
|
# "/nowhere" |
2571
|
|
|
|
|
|
|
|
2572
|
|
|
|
|
|
|
=back |
2573
|
|
|
|
|
|
|
|
2574
|
|
|
|
|
|
|
=over 4 |
2575
|
|
|
|
|
|
|
|
2576
|
|
|
|
|
|
|
=item error: C |
2577
|
|
|
|
|
|
|
|
2578
|
|
|
|
|
|
|
This package may raise an error_on_read_binmode exception. |
2579
|
|
|
|
|
|
|
|
2580
|
|
|
|
|
|
|
B |
2581
|
|
|
|
|
|
|
|
2582
|
|
|
|
|
|
|
# given: synopsis; |
2583
|
|
|
|
|
|
|
|
2584
|
|
|
|
|
|
|
my @args = ("/nowhere"); |
2585
|
|
|
|
|
|
|
|
2586
|
|
|
|
|
|
|
my $error = $path->throw('error_on_read_binmode', @args)->catch('error'); |
2587
|
|
|
|
|
|
|
|
2588
|
|
|
|
|
|
|
# my $name = $error->name; |
2589
|
|
|
|
|
|
|
|
2590
|
|
|
|
|
|
|
# "on_read_binmode" |
2591
|
|
|
|
|
|
|
|
2592
|
|
|
|
|
|
|
# my $message = $error->message; |
2593
|
|
|
|
|
|
|
|
2594
|
|
|
|
|
|
|
# "Can't binmode \"/nowhere\": $!" |
2595
|
|
|
|
|
|
|
|
2596
|
|
|
|
|
|
|
# my $path = $error->stash('path'); |
2597
|
|
|
|
|
|
|
|
2598
|
|
|
|
|
|
|
# "/nowhere" |
2599
|
|
|
|
|
|
|
|
2600
|
|
|
|
|
|
|
=back |
2601
|
|
|
|
|
|
|
|
2602
|
|
|
|
|
|
|
=over 4 |
2603
|
|
|
|
|
|
|
|
2604
|
|
|
|
|
|
|
=item error: C |
2605
|
|
|
|
|
|
|
|
2606
|
|
|
|
|
|
|
This package may raise an error_on_read_error exception. |
2607
|
|
|
|
|
|
|
|
2608
|
|
|
|
|
|
|
B |
2609
|
|
|
|
|
|
|
|
2610
|
|
|
|
|
|
|
# given: synopsis; |
2611
|
|
|
|
|
|
|
|
2612
|
|
|
|
|
|
|
my @args = ("/nowhere"); |
2613
|
|
|
|
|
|
|
|
2614
|
|
|
|
|
|
|
my $error = $path->throw('error_on_read_error', @args)->catch('error'); |
2615
|
|
|
|
|
|
|
|
2616
|
|
|
|
|
|
|
# my $name = $error->name; |
2617
|
|
|
|
|
|
|
|
2618
|
|
|
|
|
|
|
# "on_read_error" |
2619
|
|
|
|
|
|
|
|
2620
|
|
|
|
|
|
|
# my $message = $error->message; |
2621
|
|
|
|
|
|
|
|
2622
|
|
|
|
|
|
|
# "Can't read from file \"/nowhere\": $!" |
2623
|
|
|
|
|
|
|
|
2624
|
|
|
|
|
|
|
# my $path = $error->stash('path'); |
2625
|
|
|
|
|
|
|
|
2626
|
|
|
|
|
|
|
# "/nowhere" |
2627
|
|
|
|
|
|
|
|
2628
|
|
|
|
|
|
|
=back |
2629
|
|
|
|
|
|
|
|
2630
|
|
|
|
|
|
|
=over 4 |
2631
|
|
|
|
|
|
|
|
2632
|
|
|
|
|
|
|
=item error: C |
2633
|
|
|
|
|
|
|
|
2634
|
|
|
|
|
|
|
This package may raise an error_on_read_open exception. |
2635
|
|
|
|
|
|
|
|
2636
|
|
|
|
|
|
|
B |
2637
|
|
|
|
|
|
|
|
2638
|
|
|
|
|
|
|
# given: synopsis; |
2639
|
|
|
|
|
|
|
|
2640
|
|
|
|
|
|
|
my @args = ("/nowhere"); |
2641
|
|
|
|
|
|
|
|
2642
|
|
|
|
|
|
|
my $error = $path->throw('error_on_read_open', @args)->catch('error'); |
2643
|
|
|
|
|
|
|
|
2644
|
|
|
|
|
|
|
# my $name = $error->name; |
2645
|
|
|
|
|
|
|
|
2646
|
|
|
|
|
|
|
# "on_read_open" |
2647
|
|
|
|
|
|
|
|
2648
|
|
|
|
|
|
|
# my $message = $error->message; |
2649
|
|
|
|
|
|
|
|
2650
|
|
|
|
|
|
|
# "Can't read \"/nowhere\": $!" |
2651
|
|
|
|
|
|
|
|
2652
|
|
|
|
|
|
|
# my $path = $error->stash('path'); |
2653
|
|
|
|
|
|
|
|
2654
|
|
|
|
|
|
|
# "/nowhere" |
2655
|
|
|
|
|
|
|
|
2656
|
|
|
|
|
|
|
=back |
2657
|
|
|
|
|
|
|
|
2658
|
|
|
|
|
|
|
=over 4 |
2659
|
|
|
|
|
|
|
|
2660
|
|
|
|
|
|
|
=item error: C |
2661
|
|
|
|
|
|
|
|
2662
|
|
|
|
|
|
|
This package may raise an error_on_rmdir exception. |
2663
|
|
|
|
|
|
|
|
2664
|
|
|
|
|
|
|
B |
2665
|
|
|
|
|
|
|
|
2666
|
|
|
|
|
|
|
# given: synopsis; |
2667
|
|
|
|
|
|
|
|
2668
|
|
|
|
|
|
|
my @args = ("/nowhere"); |
2669
|
|
|
|
|
|
|
|
2670
|
|
|
|
|
|
|
my $error = $path->throw('error_on_rmdir', @args)->catch('error'); |
2671
|
|
|
|
|
|
|
|
2672
|
|
|
|
|
|
|
# my $name = $error->name; |
2673
|
|
|
|
|
|
|
|
2674
|
|
|
|
|
|
|
# "on_rmdir" |
2675
|
|
|
|
|
|
|
|
2676
|
|
|
|
|
|
|
# my $message = $error->message; |
2677
|
|
|
|
|
|
|
|
2678
|
|
|
|
|
|
|
# "Can't rmdir \"/nowhere\": $!" |
2679
|
|
|
|
|
|
|
|
2680
|
|
|
|
|
|
|
# my $path = $error->stash('path'); |
2681
|
|
|
|
|
|
|
|
2682
|
|
|
|
|
|
|
# "/nowhere" |
2683
|
|
|
|
|
|
|
|
2684
|
|
|
|
|
|
|
=back |
2685
|
|
|
|
|
|
|
|
2686
|
|
|
|
|
|
|
=over 4 |
2687
|
|
|
|
|
|
|
|
2688
|
|
|
|
|
|
|
=item error: C |
2689
|
|
|
|
|
|
|
|
2690
|
|
|
|
|
|
|
This package may raise an error_on_write_binmode exception. |
2691
|
|
|
|
|
|
|
|
2692
|
|
|
|
|
|
|
B |
2693
|
|
|
|
|
|
|
|
2694
|
|
|
|
|
|
|
# given: synopsis; |
2695
|
|
|
|
|
|
|
|
2696
|
|
|
|
|
|
|
my @args = ("/nowhere", ":utf8"); |
2697
|
|
|
|
|
|
|
|
2698
|
|
|
|
|
|
|
my $error = $path->throw('error_on_write_binmode', @args)->catch('error'); |
2699
|
|
|
|
|
|
|
|
2700
|
|
|
|
|
|
|
# my $name = $error->name; |
2701
|
|
|
|
|
|
|
|
2702
|
|
|
|
|
|
|
# "on_write_binmode" |
2703
|
|
|
|
|
|
|
|
2704
|
|
|
|
|
|
|
# my $message = $error->message; |
2705
|
|
|
|
|
|
|
|
2706
|
|
|
|
|
|
|
# "Can't binmode \"/nowhere\": $!" |
2707
|
|
|
|
|
|
|
|
2708
|
|
|
|
|
|
|
# my $binmode = $error->stash('binmode'); |
2709
|
|
|
|
|
|
|
|
2710
|
|
|
|
|
|
|
# ":utf8" |
2711
|
|
|
|
|
|
|
|
2712
|
|
|
|
|
|
|
# my $path = $error->stash('path'); |
2713
|
|
|
|
|
|
|
|
2714
|
|
|
|
|
|
|
# "/nowhere" |
2715
|
|
|
|
|
|
|
|
2716
|
|
|
|
|
|
|
=back |
2717
|
|
|
|
|
|
|
|
2718
|
|
|
|
|
|
|
=over 4 |
2719
|
|
|
|
|
|
|
|
2720
|
|
|
|
|
|
|
=item error: C |
2721
|
|
|
|
|
|
|
|
2722
|
|
|
|
|
|
|
This package may raise an error_on_write_error exception. |
2723
|
|
|
|
|
|
|
|
2724
|
|
|
|
|
|
|
B |
2725
|
|
|
|
|
|
|
|
2726
|
|
|
|
|
|
|
# given: synopsis; |
2727
|
|
|
|
|
|
|
|
2728
|
|
|
|
|
|
|
my @args = ("/nowhere"); |
2729
|
|
|
|
|
|
|
|
2730
|
|
|
|
|
|
|
my $error = $path->throw('error_on_write_error', @args)->catch('error'); |
2731
|
|
|
|
|
|
|
|
2732
|
|
|
|
|
|
|
# my $name = $error->name; |
2733
|
|
|
|
|
|
|
|
2734
|
|
|
|
|
|
|
# "on_write_error" |
2735
|
|
|
|
|
|
|
|
2736
|
|
|
|
|
|
|
# my $message = $error->message; |
2737
|
|
|
|
|
|
|
|
2738
|
|
|
|
|
|
|
# "Can't write to file \"/nowhere\": $!" |
2739
|
|
|
|
|
|
|
|
2740
|
|
|
|
|
|
|
# my $path = $error->stash('path'); |
2741
|
|
|
|
|
|
|
|
2742
|
|
|
|
|
|
|
# "/nowhere" |
2743
|
|
|
|
|
|
|
|
2744
|
|
|
|
|
|
|
=back |
2745
|
|
|
|
|
|
|
|
2746
|
|
|
|
|
|
|
=over 4 |
2747
|
|
|
|
|
|
|
|
2748
|
|
|
|
|
|
|
=item error: C |
2749
|
|
|
|
|
|
|
|
2750
|
|
|
|
|
|
|
This package may raise an error_on_write_open exception. |
2751
|
|
|
|
|
|
|
|
2752
|
|
|
|
|
|
|
B |
2753
|
|
|
|
|
|
|
|
2754
|
|
|
|
|
|
|
# given: synopsis; |
2755
|
|
|
|
|
|
|
|
2756
|
|
|
|
|
|
|
my @args = ("/nowhere"); |
2757
|
|
|
|
|
|
|
|
2758
|
|
|
|
|
|
|
my $error = $path->throw('error_on_write_open', @args)->catch('error'); |
2759
|
|
|
|
|
|
|
|
2760
|
|
|
|
|
|
|
# my $name = $error->name; |
2761
|
|
|
|
|
|
|
|
2762
|
|
|
|
|
|
|
# "on_write_open" |
2763
|
|
|
|
|
|
|
|
2764
|
|
|
|
|
|
|
# my $message = $error->message; |
2765
|
|
|
|
|
|
|
|
2766
|
|
|
|
|
|
|
# "Can't write \"/nowhere\": $!" |
2767
|
|
|
|
|
|
|
|
2768
|
|
|
|
|
|
|
# my $path = $error->stash('path'); |
2769
|
|
|
|
|
|
|
|
2770
|
|
|
|
|
|
|
# "/nowhere" |
2771
|
|
|
|
|
|
|
|
2772
|
|
|
|
|
|
|
=back |
2773
|
|
|
|
|
|
|
|
2774
|
|
|
|
|
|
|
=over 4 |
2775
|
|
|
|
|
|
|
|
2776
|
|
|
|
|
|
|
=item error: C |
2777
|
|
|
|
|
|
|
|
2778
|
|
|
|
|
|
|
This package may raise an error_on_unlink exception. |
2779
|
|
|
|
|
|
|
|
2780
|
|
|
|
|
|
|
B |
2781
|
|
|
|
|
|
|
|
2782
|
|
|
|
|
|
|
# given: synopsis; |
2783
|
|
|
|
|
|
|
|
2784
|
|
|
|
|
|
|
my @args = ("/nowhere"); |
2785
|
|
|
|
|
|
|
|
2786
|
|
|
|
|
|
|
my $error = $path->throw('error_on_unlink', @args)->catch('error'); |
2787
|
|
|
|
|
|
|
|
2788
|
|
|
|
|
|
|
# my $name = $error->name; |
2789
|
|
|
|
|
|
|
|
2790
|
|
|
|
|
|
|
# "on_unlink" |
2791
|
|
|
|
|
|
|
|
2792
|
|
|
|
|
|
|
# my $message = $error->message; |
2793
|
|
|
|
|
|
|
|
2794
|
|
|
|
|
|
|
# "Can't unlink \"/nowhere\": $!" |
2795
|
|
|
|
|
|
|
|
2796
|
|
|
|
|
|
|
# my $path = $error->stash('path'); |
2797
|
|
|
|
|
|
|
|
2798
|
|
|
|
|
|
|
# "/nowhere" |
2799
|
|
|
|
|
|
|
|
2800
|
|
|
|
|
|
|
=back |
2801
|
|
|
|
|
|
|
|
2802
|
|
|
|
|
|
|
=head1 OPERATORS |
2803
|
|
|
|
|
|
|
|
2804
|
|
|
|
|
|
|
This package overloads the following operators: |
2805
|
|
|
|
|
|
|
|
2806
|
|
|
|
|
|
|
=cut |
2807
|
|
|
|
|
|
|
|
2808
|
|
|
|
|
|
|
=over 4 |
2809
|
|
|
|
|
|
|
|
2810
|
|
|
|
|
|
|
=item operation: C<(.)> |
2811
|
|
|
|
|
|
|
|
2812
|
|
|
|
|
|
|
This package overloads the C<.> operator. |
2813
|
|
|
|
|
|
|
|
2814
|
|
|
|
|
|
|
B |
2815
|
|
|
|
|
|
|
|
2816
|
|
|
|
|
|
|
# given: synopsis; |
2817
|
|
|
|
|
|
|
|
2818
|
|
|
|
|
|
|
my $result = $path . '/earth'; |
2819
|
|
|
|
|
|
|
|
2820
|
|
|
|
|
|
|
# "t/data/planets/earth" |
2821
|
|
|
|
|
|
|
|
2822
|
|
|
|
|
|
|
=back |
2823
|
|
|
|
|
|
|
|
2824
|
|
|
|
|
|
|
=over 4 |
2825
|
|
|
|
|
|
|
|
2826
|
|
|
|
|
|
|
=item operation: C<(eq)> |
2827
|
|
|
|
|
|
|
|
2828
|
|
|
|
|
|
|
This package overloads the C operator. |
2829
|
|
|
|
|
|
|
|
2830
|
|
|
|
|
|
|
B |
2831
|
|
|
|
|
|
|
|
2832
|
|
|
|
|
|
|
# given: synopsis; |
2833
|
|
|
|
|
|
|
|
2834
|
|
|
|
|
|
|
my $result = $path eq 't/data/planets'; |
2835
|
|
|
|
|
|
|
|
2836
|
|
|
|
|
|
|
# 1 |
2837
|
|
|
|
|
|
|
|
2838
|
|
|
|
|
|
|
=back |
2839
|
|
|
|
|
|
|
|
2840
|
|
|
|
|
|
|
=over 4 |
2841
|
|
|
|
|
|
|
|
2842
|
|
|
|
|
|
|
=item operation: C<(ne)> |
2843
|
|
|
|
|
|
|
|
2844
|
|
|
|
|
|
|
This package overloads the C operator. |
2845
|
|
|
|
|
|
|
|
2846
|
|
|
|
|
|
|
B |
2847
|
|
|
|
|
|
|
|
2848
|
|
|
|
|
|
|
# given: synopsis; |
2849
|
|
|
|
|
|
|
|
2850
|
|
|
|
|
|
|
my $result = $path ne 't/data/planets/'; |
2851
|
|
|
|
|
|
|
|
2852
|
|
|
|
|
|
|
# 1 |
2853
|
|
|
|
|
|
|
|
2854
|
|
|
|
|
|
|
=back |
2855
|
|
|
|
|
|
|
|
2856
|
|
|
|
|
|
|
=over 4 |
2857
|
|
|
|
|
|
|
|
2858
|
|
|
|
|
|
|
=item operation: C<(qr)> |
2859
|
|
|
|
|
|
|
|
2860
|
|
|
|
|
|
|
This package overloads the C operator. |
2861
|
|
|
|
|
|
|
|
2862
|
|
|
|
|
|
|
B |
2863
|
|
|
|
|
|
|
|
2864
|
|
|
|
|
|
|
# given: synopsis; |
2865
|
|
|
|
|
|
|
|
2866
|
|
|
|
|
|
|
my $result = 't/data/planets' =~ $path; |
2867
|
|
|
|
|
|
|
|
2868
|
|
|
|
|
|
|
# 1 |
2869
|
|
|
|
|
|
|
|
2870
|
|
|
|
|
|
|
=back |
2871
|
|
|
|
|
|
|
|
2872
|
|
|
|
|
|
|
=over 4 |
2873
|
|
|
|
|
|
|
|
2874
|
|
|
|
|
|
|
=item operation: C<("")> |
2875
|
|
|
|
|
|
|
|
2876
|
|
|
|
|
|
|
This package overloads the C<""> operator. |
2877
|
|
|
|
|
|
|
|
2878
|
|
|
|
|
|
|
B |
2879
|
|
|
|
|
|
|
|
2880
|
|
|
|
|
|
|
# given: synopsis; |
2881
|
|
|
|
|
|
|
|
2882
|
|
|
|
|
|
|
my $result = "$path"; |
2883
|
|
|
|
|
|
|
|
2884
|
|
|
|
|
|
|
# "t/data/planets" |
2885
|
|
|
|
|
|
|
|
2886
|
|
|
|
|
|
|
B |
2887
|
|
|
|
|
|
|
|
2888
|
|
|
|
|
|
|
# given: synopsis; |
2889
|
|
|
|
|
|
|
|
2890
|
|
|
|
|
|
|
my $mercury = $path->child('mercury'); |
2891
|
|
|
|
|
|
|
|
2892
|
|
|
|
|
|
|
my $result = "$path, $path"; |
2893
|
|
|
|
|
|
|
|
2894
|
|
|
|
|
|
|
# "t/data/planets, t/data/planets" |
2895
|
|
|
|
|
|
|
|
2896
|
|
|
|
|
|
|
=back |
2897
|
|
|
|
|
|
|
|
2898
|
|
|
|
|
|
|
=over 4 |
2899
|
|
|
|
|
|
|
|
2900
|
|
|
|
|
|
|
=item operation: C<(~~)> |
2901
|
|
|
|
|
|
|
|
2902
|
|
|
|
|
|
|
This package overloads the C<~~> operator. |
2903
|
|
|
|
|
|
|
|
2904
|
|
|
|
|
|
|
B |
2905
|
|
|
|
|
|
|
|
2906
|
|
|
|
|
|
|
# given: synopsis; |
2907
|
|
|
|
|
|
|
|
2908
|
|
|
|
|
|
|
my $result = $path ~~ 't/data/planets'; |
2909
|
|
|
|
|
|
|
|
2910
|
|
|
|
|
|
|
# 1 |
2911
|
|
|
|
|
|
|
|
2912
|
|
|
|
|
|
|
=back |
2913
|
|
|
|
|
|
|
|
2914
|
|
|
|
|
|
|
=head1 AUTHORS |
2915
|
|
|
|
|
|
|
|
2916
|
|
|
|
|
|
|
Awncorp, C |
2917
|
|
|
|
|
|
|
|
2918
|
|
|
|
|
|
|
=cut |
2919
|
|
|
|
|
|
|
|
2920
|
|
|
|
|
|
|
=head1 LICENSE |
2921
|
|
|
|
|
|
|
|
2922
|
|
|
|
|
|
|
Copyright (C) 2000, Al Newkirk. |
2923
|
|
|
|
|
|
|
|
2924
|
|
|
|
|
|
|
This program is free software, you can redistribute it and/or modify it under |
2925
|
|
|
|
|
|
|
the terms of the Apache license version 2.0. |
2926
|
|
|
|
|
|
|
|
2927
|
|
|
|
|
|
|
=cut |