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

[perl #108778] no warnings "module name"

Thread Previous | Thread Next
From:
Father Chrysostomos via RT
Date:
November 21, 2017 17:01
Subject:
[perl #108778] no warnings "module name"
Message ID:
rt-4.0.24-18569-1511283654-1489.108778-14-0@perl.org
On Mon, 20 Nov 2017 01:56:20 -0800, zefram@fysh.org 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 overload.pm that I filed this ticket to begin with.

At the very least, can we make warnings.pm 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


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About