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

Re: Protocol/convention for optional lint-type warnings

Thread Previous
Dan Book
November 19, 2021 17:08
Re: Protocol/convention for optional lint-type warnings
Message ID:
On Fri, Nov 19, 2021 at 11:55 AM Paul "LeoNerd" Evans <> wrote:

> A few times in either perl core, or some modules like syntax modules,
> I've found places where I've wanted to add very-optional warnings that
> aren't enabled by default, but suggest to the author that "you're doing
> something a bit weird here", or maybe "eh; this feature might be
> removed in a later version so you want to swap to something else", but
> it isn't yet a problem that should warn for end-users.
> I'm thinking there ought to be some standard way to enable these
> non-default warnings that both perl core and whatever modules can all
> follow, to enable these things. I'd then want to enable that when
> doing my author testing so I can see these extra things.
> It shouldn't require any source changes (so any lexical pragmas etc..
> are no good) because I'd want to optionally enable it during auther
> testing alone, but I wonder about using an environment variable.
> For example, I could
>   $ PERL_WARN_ME_HARDER=1 ./Build test
>   t/00use.t ..... Hey you probably shouldn't be doing this weird thing
>   at line 123.
>   t/00use.t ..... ok
> Before I try to create something new (or just propose the-above), I
> wonder: Are there any existing precedents for this kind of thing
> already?

This is similar to my impetus for suggesting optional warnings here:

I think the first step is defining a category for such warnings, and a way
to implement them without including them in "use warnings;".

An environment variable to request them all together as you suggest, or
some subset, sounds more reasonable than an import argument that subjects
the code to all manner of future optional warnings.


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