On Sat, Jun 27, 2015 at 05:39:32PM -0500, Tom Browder wrote:
> I'm trying to take advantage of the MAIN suroutine to handle most all of my
> routine command line arg handling. One idiom I use a lot is for the user
> to choose only one of two args, but one must be chosen.
Perhaps you want that the named arguments are required rather than
optional, via the exclamation point. Thus:
multi sub MAIN(:$need!) { say "need"; }
multi sub MAIN(:$hope!) { say "hope"; }
If passed with either option, it executes the corresponding multi candidate.
If neither or both options are passed, it produces a usage message:
pmichaud@kiwi:~/p6/rakudo$ ./perl6 x.p6
Usage:
x.p6 --need=<Any>
x.p6 --hope=<Any>
Pm