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

[perl #108778] no warnings "module name"

Thread Previous | Thread Next
Father Chrysostomos via RT
November 21, 2017 17:01
[perl #108778] no warnings "module name"
Message ID:
On Mon, 20 Nov 2017 01:56:20 -0800, wrote:
> 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.

I think you are right.  It is confusing.

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

It’s not that unusual if you consider that it was because of that I filed this ticket to begin with.

At the very least, can we make register the overload category, or make overload a core category?

I want to avoid this, which is not very maintainable:

use warnings;
use overload ();
no warnings 'overload';
use overload ....;


Father Chrysostomos

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