Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
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
  • Loading branch information
JJ committed Feb 3, 2019
1 parent f0cb1f6 commit 2c79560
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions doc/Type/IO/ArgFiles.pod6
Expand Up @@ -78,6 +78,18 @@ sub MAIN () {
and, in fact, can't be used to process the arguments in the command line, since,
in this case, it would result in an usage error.
Bear in mind that C<$*ARGFILES> is going to contain an handle for every argument
in a command line, even if that argument is not a valid file.
=for code
for $*ARGFILES.handles -> $fh {
say $fh;
}
That code will fail if any of the arguments is not the valid name of a file. You
will have to deal with that case at another level, checking that
L<C<@*ARGS>|/language/variables#index-entry-%40*ARGS> contains valid file names,
for instance.
=end pod

Expand Down

0 comments on commit 2c79560

Please sign in to comment.