File tree Expand file tree Collapse file tree 1 file changed +12
-7
lines changed Expand file tree Collapse file tree 1 file changed +12
-7
lines changed Original file line number Diff line number Diff line change @@ -877,17 +877,22 @@ call L<exit|https://docs.perl6.org/routine/exit>.
877
877
= head2 C < %*SUB-MAIN-OPTS >
878
878
879
879
It's possible to alter how arguments are processed before they're passed
880
- to C < sub MAIN {} > by setting options in C < %*SUB-MAIN-OPTS > hash. Available
881
- options are:
882
-
883
- = head3 C < named-anywhere >
884
-
885
- (my %*SUB-MAIN-OPTS)<named-anywhere> = True;
880
+ to C < sub MAIN {} > by setting options in C < %*SUB-MAIN-OPTS > hash. Due to the
881
+ nature of dynamic variables, one needs to set up its own C < %*SUB-MAIN-OPTS >
882
+ hash and fill it with the appropriate settings. For instance:
883
+
884
+ my %*SUB-MAIN-OPTS =
885
+ :named-anywhere, # allow named variables at any location
886
+ :!foo, # don't allow foo
887
+ ;
886
888
sub MAIN ($a, $b, :$c, :$d) {
887
889
say "Accepted!"
888
890
}
889
891
890
- I « Note the use of parentheses around C < (my %*SUB-MAIN-OPTS) > » .
892
+ Available options are:
893
+
894
+ = head3 C < named-anywhere >
895
+
891
896
By default, named arguments to the program cannot be given after any positional
892
897
arguments are specified. However, if C « %*SUB-MAIN-OPTS < named-anywhere > » is
893
898
set to a truthy value, named arguments can be specified anywhere, even after
You can’t perform that action at this time.
0 commit comments