@@ -203,11 +203,12 @@ or:
203
203
204
204
my $path = $fileonNTFS.IO(:SPEC<Win32>); # auto-expand to IO::Spec::Win32
205
205
206
- =head2 Functions, Roles and Classes
206
+ =head2 Functions and Classes
207
207
208
- The roles and classes that define most of the functionality for IO are defined
209
- in S32-setting-library/IO.pod. The main functions used are listed in S29 with
210
- references to S32-setting-library/IO.pod. An overview:
208
+ The functions and classes that define most of the functionality for IO are
209
+ more thoroughly defined in S32-setting-library/IO.pod. The main functions
210
+ used are listed in S29 with references to S32-setting-library/IO.pod.
211
+ An overview:
211
212
212
213
=head3 Functions
213
214
@@ -250,50 +251,6 @@ references to S32-setting-library/IO.pod. An overview:
250
251
islink($target); # is the file a symbolic link?
251
252
readlink($target); # the destination of the symlink ($source)
252
253
253
- =head3 IO::FileTestable Role
254
-
255
- Role to be consumed by both C<IO::Path> as well as C<IO::Handle>.
256
-
257
- $io.r $!path of $io is readable by effective uid/gid
258
- $io.w $!path of $io is writable by effective uid/gid
259
- $io.x $!path of $io is executable by effective uid/gid
260
- $io.o $!path of $io is owned by effective uid
261
-
262
- $io.R $!path of $io is readable by real uid/gid
263
- $io.W $!path of $io is writable by real uid/gid
264
- $io.X $!path of $io is executable by real uid/gid
265
- $io.O $!path of $io is owned by real uid
266
-
267
- $io.e $!path of $io exists
268
- $io.s Size of the $!path of $io in bytes
269
- $io.z $!path of $io has zero size (an empty file)
270
-
271
- $io.f $!path of $io is a plain file
272
- $io.d $!path of $io is a directory
273
- $io.l $!path of $io is a symbolic link
274
- $io.p $!path of $io is a named pipe (FIFO)
275
- $io.S $!path of $io is a socket
276
- $io.b $!path of $io is a block special file
277
- $io.c $!path of $io is a character special file
278
-
279
- $io.u $!path of $io has setuid bit set
280
- $io.g $!path of $io has setgid bit set
281
- $io.k $!path of $io has sticky bit set
282
-
283
- $io.accessed last access time of $!path of $io (if available)
284
- $io.modified last modified time of $!path of $io
285
- $io.changed last (metadata) changed time of $!path of $io
286
-
287
- To allow for easy chaining of file tests, there is an C<.all> method that can
288
- be fed the tests to be tried as a C<Parcel> of strings. The value returned
289
- will be the first non-True value, or the final True value.
290
-
291
- say "rwx" if $io.all: <r w x>;
292
-
293
- if $io.all(<r w x s>) -> $size {
294
- say "rwx $size bytes";
295
- }
296
-
297
254
=head3 IO::Spec Class
298
255
299
256
The C<IO::Spec> itself only has one method: C<select>. It takes an OS
@@ -325,7 +282,7 @@ order):
325
282
326
283
=head3 IO::Path Class
327
284
328
- class IO::Path is Cool does IO::FileTestable { }
285
+ class IO::Path is Cool { }
329
286
330
287
The official way to create an C<IO::Path> object is with the C<new> method.
331
288
Apart from the C<path> positional, it also takes optional C<:SPEC> and
@@ -348,7 +305,49 @@ parameters:
348
305
349
306
my $path = IO::Path.new( :$volume, :$directory, :$basename );
350
307
351
- The following methods are also provided (in alphabetical order):
308
+ The following file test methods are provided:
309
+
310
+ r is readable by effective uid/gid
311
+ w is writable by effective uid/gid
312
+ x is executable by effective uid/gid
313
+ o is owned by effective uid
314
+
315
+ R is readable by real uid/gid
316
+ W is writable by real uid/gid
317
+ X is executable by real uid/gid
318
+ O is owned by real uid
319
+
320
+ e exists
321
+ s Size of the $!path of $io in bytes
322
+ z has zero size (an empty file)
323
+
324
+ f is a plain file
325
+ d is a directory
326
+ l is a symbolic link
327
+ p is a named pipe (FIFO)
328
+ S is a socket
329
+ b is a block special file
330
+ c is a character special file
331
+
332
+ u has setuid bit set
333
+ g has setgid bit set
334
+ k has sticky bit set
335
+
336
+ accessed last access time of $!path of $io (if available)
337
+ modified last modified time of $!path of $io
338
+ changed last (metadata) changed time of $!path of $io
339
+
340
+ To allow for easy chaining of file tests, there is an C<.all> method that can
341
+ be fed the tests to be tried as a C<Parcel> of strings. The value returned
342
+ will be the first non-True value, or the final True value.
343
+
344
+ say "rwx" if $path.all: <r w x>;
345
+
346
+ if $path.all(<f r w x s>) -> $size {
347
+ say "plain file with rwx of $size bytes";
348
+ }
349
+
350
+ These other methods are also provided (in alphabetical order):
352
351
353
352
absolute the absolute, canonical path
354
353
basename the basename of the path
@@ -378,7 +377,7 @@ The following methods are also provided (in alphabetical order):
378
377
379
378
=head3 IO::Handle Class
380
379
381
- class IO::Handle does IO::FileTestable { }
380
+ class IO::Handle { }
382
381
383
382
The C<IO::Handle> object is usually B<not> directly instantiated, but usually
384
383
with C<open()> or C<IO::Path.open>. Nonetheless, you B<can> create an
@@ -408,7 +407,7 @@ C<.open> has been called succesfully:
408
407
IO return new IO::Path of path of file
409
408
lines return rest of contents of file as lines
410
409
opened is the file open?
411
- path return new IO::Path of path of file
410
+ path the IO::Path of path of file, handles file tests
412
411
print write characters to file
413
412
read read bytes from file
414
413
say write characters + newline to file
0 commit comments