blib/lib/no/warnings.pm

filter: Statementstmt 82.6% 19 / 23 Branchbran 33.3% 2 / 6 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 83.3% 5 / 6 Podpod n/a totaltotal 74.2% 26 / 35 CC 4 SCAR 16.0
CC
4
Cov
72%
__ANON__
12.0
warnings
2.4
BEGIN
1.0
CRAP 5.0
↑ Summary
1 2 ▶use 5.008003;
Subroutine BEGIN: called CC=1 SCAR=0.0
2 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 2 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 package no::warnings;
6  
7 2 our $AUTHORITY = 'cpan:TOBYINK';
8 2 our $VERSION = '0.001000';
9  
10 6 ▶sub no::warnings {
Subroutine warnings: called CC=2 SCAR=8.5
11 6 my $code = pop;
12 6 my $next = $SIG{__WARN__};
13 6 ▶ my $handler = sub {};
Subroutine __ANON__: called CC=1 SCAR=0.0
14
15 6 ▶ if ( @_ ) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) 2 4 6
16 2 my @ignore = @_;
17 2 require match::simple;
18 0 ▶ $handler = sub {
Subroutine __ANON__: not called CC=3 SCAR=24.8
19 0 my $warning = shift;
20 0 ▶ return if match::simple::match( $warning, \@ignore );
Branch: 1 branch
BranchTrueFalseTotal
if match::simple::match($warning, \@ignore) 0 0 0
21 0 ▶ $next ? $next->( $warning ) : warn( $warning );
Branch: 1 branch
BranchTrueFalseTotal
$next ? : 0 0 0
22 0 };
23 }
24
25 4 local $SIG{__WARN__} = $handler;
26 4 return $code->();
27 }
28  
29 2 1;
30  
31 __END__
↑ Summary