develooper Front page | perl.perl5.porters | Postings from June 2021

Re: RFC - Issue a warning "-np better written as -p"

Thread Previous | Thread Next
From:
Nicholas Clark
Date:
June 17, 2021 06:22
Subject:
Re: RFC - Issue a warning "-np better written as -p"
Message ID:
20210617062241.GE16703@etla.org
On Wed, Jun 16, 2021 at 11:36:39AM -0400, Dan Book wrote:
> On Wed, Jun 16, 2021 at 4:51 AM Nicholas Clark <nick@ccl4.org> wrote:
> 
> > https://github.com/Perl/perl5/issues/18641 becomes our next test RFC.
> >
> 
> I don't think it's particularly useful to warn about this. Nothing is
> broken or potentially broken by specifying unnecessary switches. I would
> suggest it could become an optional warning if and when we add support for
> that, but this would only come up for oneliners which are not likely to go
> to the effort of enabling optional warnings of any sort.

I'm going to guess the same for one-liners - they likely won't invoke
warnings. (The numbers from the Debian source searches suggest this)

But it can't be an *optional* warning, because if it is going to warn, it
needs to be enabled by '-w' on the command line, and I doubt that we're
going to change '-w' to be "optional too", or however we do it. I'd assume
that '-w' needs to keep meaning `use warnings`


However, skimming the source search results suggests that it's mostly
written as '-np'. And we document that '-p' overrides '-n', so this common
ordering is consistent with actual behaviour.

Maybe we should warn on '-pn' - ie order matters too - '-n' flag ignored.

Maybe not changing anything is best. I already said that I didn't know :-)

Nicholas Clark

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