develooper Front page | perl.perl6.users | Postings from April 2022

Re: checking MAIN arguments

Thread Previous | Thread Next
From:
William Michels via perl6-users
Date:
April 14, 2022 22:59
Subject:
Re: checking MAIN arguments
Message ID:
CAA99HCwsUONg3XvTBKHEyKq30kLqtRGgTC2iTe_LBuq+DqfYVg@mail.gmail.com
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 <fluca1978@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
>

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About