Skip to content

Commit 372545c

Browse files
committed
[io grant] Straighten up file test docs
1 parent 1527d32 commit 372545c

File tree

1 file changed

+45
-26
lines changed

1 file changed

+45
-26
lines changed

doc/Type/IO/Path.pod6

Lines changed: 45 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -380,73 +380,92 @@ my $perl-files = gather while @stack {
380380
381381
=head2 method e
382382
383-
method e(--> Bool)
383+
method e(--> Bool:D)
384384
385-
Returns C<Bool::True> if the invocant is a valid path that exists.
385+
Returns C<True> if the invocant is a path that exists.
386386
387387
=head2 method d
388388
389-
method d(--> Bool)
389+
method d(--> Bool:D)
390390
391-
Returns C<Bool::True> if the invocant is a path and the directory exists.
391+
Returns C<True> if the invocant is a path that exists and is a directory.
392+
The method will L«C<fail>|/routine/fail» with C<X::IO::DoesNotExist> if the
393+
path points to a non-existent object.
392394
393395
=head2 method f
394396
395-
method f(--> Bool)
397+
method f(--> Bool:D)
396398
397-
Returns C<Bool::True> if the invocant is a path and the file exists.
399+
Returns C<True> if the invocant is a path that exists and is a file.
400+
The method will L«C<fail>|/routine/fail» with C<X::IO::DoesNotExist> if the
401+
path points to a non-existent object.
398402
399403
=head2 method s
400404
401-
method s(--> Int)
405+
method s(--> Int:D)
402406
403-
If the path is valid and points to a regular file the size of that file
404-
in bytes is returned. If the path is valid but pointing to something which
405-
is not a file, e.g. a directory, a L<X::IO::NotAFile> exception is thrown.
406-
An exception is also thrown if the path is invalid, in that case the exception
407-
type is L<X::IO::DoesNotExist>.
407+
Returns the filesize in bytes. May be called on paths that are directories, in
408+
which case the reported size is dependant on the operating system.
409+
The method will L«C<fail>|/routine/fail» with C<X::IO::DoesNotExist> if the
410+
path points to a non-existent object.
408411
409412
=head2 method l
410413
411-
method l(--> Bool)
414+
method l(--> Bool:D)
412415
413-
Returns C<Bool::True> if the invocant is a path and a symlink.
416+
Returns C<True> if the invocant is a path that exists and is a symlink.
417+
The method will L«C<fail>|/routine/fail» with C<X::IO::DoesNotExist> if the
418+
path points to a non-existent object.
414419
415420
=head2 method r
416421
417-
method r(--> Bool)
422+
method r(--> Bool:D)
418423
419-
Returns C<Bool::True> if the invocant is a path and accessible.
424+
Returns C<True> if the invocant is a path that exists and is accessible.
425+
The method will L«C<fail>|/routine/fail» with C<X::IO::DoesNotExist> if the
426+
path points to a non-existent object.
420427
421428
=head2 method w
422429
423-
method w(--> Bool)
430+
method w(--> Bool:D)
424431
425-
Returns C<Bool::True> if the invocant is a path and writable.
432+
Returns C<True> if the invocant is a path that exists and is writable.
433+
The method will L«C<fail>|/routine/fail» with C<X::IO::DoesNotExist> if the
434+
path points to a non-existent object.
426435
427436
=head2 method rw
428437
429-
method rw(--> Bool)
438+
method rw(--> Bool:D)
430439
431-
Returns C<Bool::True> if the invocant is a path, readable and writable.
440+
Returns C<True> if the invocant is a path that exists and is readable and
441+
writable. The method will L«C<fail>|/routine/fail» with C<X::IO::DoesNotExist>
442+
if the path points to a non-existent object.
432443
433444
=head2 method x
434445
435-
method x(--> Bool)
446+
method x(--> Bool:D)
436447
437-
Returns C<Bool::True> if the invocant is a path and executable.
448+
Returns C<True> if the invocant is a path that exists and is executable.
449+
The method will L«C<fail>|/routine/fail» with C<X::IO::DoesNotExist> if the
450+
path points to a non-existent object.
438451
439452
=head2 method rwx
440453
441-
method rwx(--> Bool)
454+
method rwx(--> Bool:D)
442455
443-
Returns C<Bool::True> if the invocant is a path, executable, readable and writable.
456+
Returns C<True> if the invocant is a path that exists and is executable,
457+
readable, and writable. The method will L«C<fail>|/routine/fail» with
458+
C<X::IO::DoesNotExist> if the path points to a non-existent object.
444459
445460
=head2 method z
446461
447-
method z(--> Bool)
462+
method z(--> Bool:D)
448463
449-
Returns C<Bool::True> if the invocant is a path and the size is 0.
464+
Returns C<True> if the invocant is a path that exists and has size of C<0>.
465+
May be called on paths that are directories, in
466+
which case the reported filesize (and thus the result of this method)
467+
is dependant on the operating system. The method will L«C<fail>|/routine/fail»
468+
with C<X::IO::DoesNotExist> if the path points to a non-existent object.
450469
451470
=head2 routine slurp
452471

0 commit comments

Comments
 (0)