Fails on 𝐑𝐚𝐤𝐮𝐝𝐨™ v2021.06.

~$ raku Luca_Ferrari.p6
Use of uninitialized value of type Any in string context.
Methods .^name, .raku, .gist, or .say can be used to stringify it to
something meaningful.
  in block  at Luca_Ferrari.p6 line 1
Specify the
directory []
  in block  at Luca_Ferrari.p6 line 1
Use of uninitialized value of type Any in string context.
Methods .^name, .raku, .gist, or .say can be used to stringify it to
something meaningful.
  in block  at Luca_Ferrari.p6 line 1
Specify the
directory []
  in block  at Luca_Ferrari.p6 line 1
Usage:
  Luca_Ferrari.p6 [--dir=<Str where { ... }>]


...although I do come somewhat close:

~$ raku Luca_Ferrari.p6 --dir=foo
Use of uninitialized value of type Any in string context.
Methods .^name, .raku, .gist, or .say can be used to stringify it to
something meaningful.
  in block  at Luca_Ferrari.p6 line 1
Specify the
directory []
  in block  at Luca_Ferrari.p6 line 1
foo


HTH, Bill.

On Tue, Apr 12, 2022 at 1:16 AM Luca Ferrari <fluca1...@gmail.com> wrote:

> Hello all,
> given this simple program:
>
> sub MAIN( Str :$dir where { .so && .IO.d // warn "Specify the
> directory [$dir]" } ) {
>     say $dir;
> }
>
> it works as I expect on ancient versions of rakudo, e.g., 202-01, but
> it fails miserably on current rakudo:
>
> % raku ~/tmp/test.p6 --dir=foo
> Use of uninitialized value of type Any in string context.
> Methods .^name, .raku, .gist, or .say can be used to stringify it to
> something meaningful.
>  in block  at /home/luca/tmp/test.p6 line 4
> Specify the directory []
>  in block  at /home/luca/tmp/test.p6 line 4
> Specify the directory [foo]
>  in block  at /home/luca/tmp/test.p6 line 4
> Use of uninitialized value of type Any in string context.
> Methods .^name, .raku, .gist, or .say can be used to stringify it to
> something meaningful.
>  in block  at /home/luca/tmp/test.p6 line 4
> Specify the directory []
>  in block  at /home/luca/tmp/test.p6 line 4
> Usage:
>  /home/luca/tmp/test.p6 [--dir=<Str where { ... }>]
>
> Note that in the above output there is a point, in the middle, where
> the wanr function has the value of the argument, so I don't understand
> why it is complaining.
> Is there a way to spurt a warn message in the case a parameter is not fine?
>
> Thanks,
> Luca
>

Reply via email to