develooper Front page | perl.perl6.users | Postings from September 2019

Re: more unixish perl6?

Thread Previous | Thread Next
Peter Pentchev
September 24, 2019 08:18
Re: more unixish perl6?
Message ID:
On Tue, Sep 24, 2019 at 09:50:06AM +0200, Marc Chantreux wrote:
> hello,
> i don't know if it's useful to feedback on it but i would like to share
> about MAIN.
> this is a very nice thing to have it built-in so the quality of your
> scripts can be improved without effort ($*USAGE is very nice!) but
> here are some parts i feel i miss.
> * dealing with $*ARGFILES should be simpler (something like the closing @ in
>   perl5 signatures)
> * a support of arguments cluster would be (both '-s -d +' and  '-sd+' should be valid)

I know this is not quite what you're looking for, but JFTR (shameless
plug) there is the Getopt::Std Perl 6 module that implements old-style
getopt()-like argument parsing. The downsides are that it does not
support long options (this is on purpose - I personally am not a big fan
of long options, although I do understand why others may like them),
it does not do automatic --help and --version handling (also on purpose,
maybe I'm a bit of a control freak, but I do like the code paths to be
explicit), and, of course, it does not have the awesome Perl 6 "multi
sub MAIN" automated handling of groups of options :)

> * having something like auto-help that print $*USAGE on $*OUT
>   multi sub MAIN ( Bool :h(:$help), +@rest ) { $*USAGE.say }

Just to make it clear: I very much like that Perl 6 has automated
options handling depending on the arguments to MAIN, it's just that some
of my programs do not need it.

> aside: the perl6 error messages comes with escape caracters even if $*ERR isn't tty.
> this is unusual and makes things boring when you capture the error into
> an editor or a filter. i don't know if it can be useful in some cases.


Peter Pentchev  roam@{,,}
PGP key:
Key fingerprint 2EE7 A7A5 17FC 124C F115  C354 651E EFB0 2527 DF13

Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About