File Coverage

blib/lib/no/warnings.pm
Criterion Covered Total %
statement 20 20 100.0
branch 5 6 83.3
condition n/a
subroutine 6 6 100.0
pod n/a
total 31 32 96.8


line stmt bran cond sub pod time code
1 2     2   450666 use 5.008003;
  2         9  
2 2     2   12 use strict;
  2         12  
  2         45  
3 2     2   42 use warnings;
  2         4  
  2         998  
4              
5             package no::warnings;
6              
7             our $AUTHORITY = 'cpan:TOBYINK';
8             our $VERSION = '0.001000';
9              
10             sub no::warnings {
11 6     6   419595 my $code = pop;
12 6         31 my $next = $SIG{__WARN__};
13 6     1   50 my $handler = sub {};
14            
15 6 100       40 if ( @_ ) {
16 2         6 my @ignore = @_;
17 2         733 require match::simple;
18             $handler = sub {
19 2     2   50 my $warning = shift;
20 2 100       21 return if match::simple::match( $warning, \@ignore );
21 1 50       42 $next ? $next->( $warning ) : warn( $warning );
22 2         8605 };
23             }
24            
25 6         32 local $SIG{__WARN__} = $handler;
26 6         26 return $code->();
27             }
28              
29             1;
30              
31             __END__