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
In reply to Re^2: Optionally / safely disabling a warning category for a complete package (silent failure)
by tye
in thread Optionally / safely disabling a warning category for a complete package
by Corion
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |