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

Re: [perl #108778] no warnings "module name"

Thread Previous | Thread Next
From:
Zefram
Date:
November 20, 2017 09:56
Subject:
Re: [perl #108778] no warnings "module name"
Message ID:
20171120095556.GP4913@fysh.org
Father Chrysostomos wrote:
>use warnings;
>{ package # hide from PAUSE
>   Hash::Util; use warnings::register }
>no warnings qw 'once Hash::Util';

That's nasty.  warnings::register is a shortcut for the common case of
packages registering their own category; it's just obfuscatory to go
through it to register an unrelated package's category.

>use warnings;
>BEGIN { warnings::register_categories "Hash::Util" }
>no warnings qw 'once Hash::Util';

This is what I envisioned, and I think it's the pattern to favour.
It's nice and clear, with the registration explicit and distinct from
the bitset toggling.

>use warnings;
>no warnings 'once' , REGISTER => "Hash::Util";

Strikes me as confusing.  What does it do to the Hash::Util category,
exactly?  Register it, yes, but also operate on its lexical enablement?
More a problem with "use warnings REGISTER => ...", but it's unclear
in any case.  Also, the FATAL/NONFATAL directives are confusing enough,
and this would introduce combinations of the directives.

Registering someone else's warning category is an unusual requirement.
It doesn't need to be especially succinct.

-zefram

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