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

Re: checking MAIN arguments

Thread Previous | Thread Next
From:
Luca Ferrari
Date:
April 16, 2022 15:49
Subject:
Re: checking MAIN arguments
Message ID:
CAKoxK+4MXdQYKF0QOoB6uufVexEGUSm-Nbcb3khCAYF3-NoPvQ@mail.gmail.com
On Fri, Apr 15, 2022 at 4:15 PM yary <not.com@gmail.com> wrote:
>
> Here's how I ended up handling input arg validation, with meaningful error messages, as part of a Perl Weekly Challenge a couple years ago. It looks almost the same as Luca's original, except mine uses "die" instead of "warn", which means it won't attempt to continue once it encounters a bad arg.

Interesting, but I used `warn` because I want to display all things
that are not correct at once. In the test case I submitted there is no
great difference in using warn instead of die, since the program
should stop in any case, but if you have a bunch of named arguments I
would like to see all `warn` messages at once, so I have a chance to
fix all my invocation line at once.

> I'm starting to think Luca's found a regression, since using the explicit variable name instead of the topic fixes the issue. That seems wrong.

I don't know, in the beginning I thought there was a problem with the
language specifcation, I mean, something has changed in the `wherre`
and topic usage. However, hoping to improve our knowledge or the
implementation, I've submitted an issue here
<https://github.com/rakudo/rakudo/issues/4878>.

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