Skip to content

Commit 2c79560

Browse files
committed
Adds an example which fails with invalid filehandles.
I couldn't find a way to deal with them, as indicated in #96 and rakudo/rakudo#2666. I asked [this question in SO](https://stackoverflow.com/questions/54501546/dealing-with-invalid-filehandles-and-maybe-other-invalid-objects-too), will reopen if there's some answer that does not involve catching the error. Meanwhile, closes #96
1 parent f0cb1f6 commit 2c79560

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

doc/Type/IO/ArgFiles.pod6

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,18 @@ sub MAIN () {
7878
and, in fact, can't be used to process the arguments in the command line, since,
7979
in this case, it would result in an usage error.
8080
81+
Bear in mind that C<$*ARGFILES> is going to contain an handle for every argument
82+
in a command line, even if that argument is not a valid file.
83+
84+
=for code
85+
for $*ARGFILES.handles -> $fh {
86+
say $fh;
87+
}
88+
89+
That code will fail if any of the arguments is not the valid name of a file. You
90+
will have to deal with that case at another level, checking that
91+
L<C<@*ARGS>|/language/variables#index-entry-%40*ARGS> contains valid file names,
92+
for instance.
8193
8294
=end pod
8395

0 commit comments

Comments
 (0)