Skip to content

Commit

Permalink
Document %*SUB-MAIN-OPTS
Browse files Browse the repository at this point in the history
  • Loading branch information
zoffixznet committed Jun 29, 2017
1 parent 559b74f commit 5c766b7
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions doc/Language/functions.pod6
Expand Up @@ -874,6 +874,30 @@ call L<exit|https://docs.perl6.org/routine/exit>.
exit 1;
}
=head2 C<%*SUB-MAIN-OPTS>
It's possible to alter how arguments are processed before they're passed
to C<sub MAIN {}> by setting options in C<%*SUB-MAIN-OPTS> hash. Available
options are:
=head3 C<named-anywhere>
%*SUB-MAIN-OPTS<named-anywhere> = True;
sub MAIN ($a, $b, :$c, :$d) {
say "Accepted!"
}
By default, named arguments to the program cannot be given after any positional
arguments are specified. However, if C«%*SUB-MAIN-OPTS<named-anywhere>» is
set to a truthy value, named arguments can be specified anywhere, even after
positional parameter. For example, the above program can be called with:
=begin code :skip-test
perl6 example.p6 1 --c=2 3 --d=4
=end code
=head1 C<sub USAGE>
X<|USAGE>
Expand Down

0 comments on commit 5c766b7

Please sign in to comment.