Sub args: choose one of two?

2015-06-27 Thread Tom Browder
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. Reading S06, I don't yet see a way to do that without dropping back to handling the @*ARGV a

Re: Sub args: choose one of two?

2015-06-27 Thread yary
This "sort of" works, in that it does the right thing when you give one correct arg, and fails when you give neither arg or both args. The error message is good when you give both args, but LTA with no args. # Require either named arg "need" or named arg "hope", but not both multi sub MAIN (Int :

Re: Sub args: choose one of two?

2015-06-27 Thread Tom Browder
On Jun 27, 2015 7:39 PM, "yary" wrote: > > This "sort of" works, in that it does the right thing when you give one > correct arg, and fails when you give neither arg or both args. The error > message is good when you give both args, but LTA with no args. Thanks, Yary, Good use of multi which I pa

Re: Sub args: choose one of two?

2015-06-27 Thread Brent Laabs
http://design.perl6.org/S99.html#LTA On Sat, Jun 27, 2015 at 5:57 PM, Tom Browder wrote: > On Jun 27, 2015 7:39 PM, "yary" wrote: > > > > This "sort of" works, in that it does the right thing when you give one > > correct arg, and fails when you give neither arg or both args. The error > > mess

Re: Sub args: choose one of two?

2015-06-27 Thread Tom Browder
On Jun 27, 2015 8:05 PM, "Brent Laabs" wrote: > > http://design.perl6.org/S99.html#LTA Ah, I almost guessed right! Best, -Tom