# New Ticket Created by Jake Russo
# Please include the string: [perl #127864]
# in the subject line of all future correspondence about this issue.
# <URL: https://rt.perl.org/Ticket/Display.html?id=127864 >
>From IRC:
9:22 PM <MadcapJake> if I pass a : at the beginning of a string argument to
MAIN, it fails to match any signatures and triggers the Usage message
9:25 PM <ZoffixWin> MadcapJake, can't reproduce. What's the sig for MAIN you're
using and what's the way you're calling the script with?
9:25 PM <MadcapJake> ./bin/rabble -e -d ": addone 1 + ; 1 addone ."
9:26 PM <ZoffixWin> MadcapJake, but the usage message tells you to use -d="..."
doesn't it? You're missing the equals sign
9:26 PM <MadcapJake> no, those are Bools
9:27 PM <MadcapJake> ~/github/rabble/bin/rabble --expression|-e [--debug|-d]
<expr>
9:27 PM <MadcapJake> ~/github/rabble/bin/rabble [--debug|-d] <file>
9:28 PM <ZoffixWin> MadcapJake, confirmed on my box. You should rakudobug this:
perl6 -e 'sub MAIN ($x) {}' ": 42" <-- triggers usage... perl6 -e 'sub MAIN
($x) {}' "42" <-- no usage
9:28 PM <MadcapJake> :(Str $expr, Bool :expression(:$e)!, Bool :debug(:$d)) is
the signature I'm trying to match
9:29 PM <ZoffixWin> The bug seems to exist with a single positional as well. A
":" as the first char in the positional breaks something
9:33 PM <ZoffixWin> MadcapJake, are you rakudobugging it? I found this works:
to set $y to 45: perl6 -e 'sub MAIN ($x, :$y) { say $y }' ":y=45" 42
9:34 PM <ZoffixWin> In addition it's also impossible to pass "-y=45" to a
positional argument, because it gets interpreted as a named arg, it seems
9:35 PM <teatime> ZoffixWin: even if you do -- first ?
9:35 PM <ZoffixWin> teatime, was about to say.... the -- is the way.
9:35 PM <ZoffixWin> This is more about the shell than Perl 6, but :y should
still be parsed as normal string and not a named arg IMO
9:36 PM <ZoffixWin> perl6 -e 'sub MAIN ($x) { say $x }' -- ":y=45" works fine
9:36 PM <ZoffixWin> Unless there are some shells where : instead of - on args
is used that I'm unaware of.