Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re^2: Optionally / safely disabling a warning category for a complete package (silent failure)

by tye (Sage)
on May 18, 2016 at 19:39 UTC ( [id://1163370]=note: print w/replies, xml ) Need Help??


in reply to Re: Optionally / safely disabling a warning category for a complete package (magic numbers)
in thread Optionally / safely disabling a warning category for a complete package

Though, this approach also has the disadvantage of silently failing if your "no warnings" should be supported but something weird is just broken. You could mitigate that problem by emitting a warning (or fatal error) if the failure reason doesn't match the one expected, but that can lead to noise when your expectations become incorrect, of course.

BEGIN { my $class = 'experimental::signatures'; if( eval "no warnings '$class'; 1" ) { warnings->unimport($class); } elsif( $@ !~ /Unknown warnings category / ) { warn "'no warnings' failed: $@\n"; # Or even die(). } }

- tye        

  • Comment on Re^2: Optionally / safely disabling a warning category for a complete package (silent failure)
  • Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1163370]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others learning in the Monastery: (5)
As of 2024-04-19 02:07 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found