blib/lib/Filter/Cleanup.pm

filter: Statementstmt 73.2% 41 / 56 Branchbran 50.0% 2 / 4 Conditioncond 50.0% 1 / 2 MC/DCmcdc 0.0% 0 / 1 Subroutinesub 90.0% 9 / 10 Podpod 0.0% 0 / 1 totaltotal 71.6% 53 / 74 CC 4 SCAR 5.7
CC
4
Cov
71%
import
3.5
DESTROY
2.1
__ANON__
1.1
CRAP 1.8
↑ Summary
1 package Filter::Cleanup;
2 # ABSTRACT: Execute cleanup statements when scope closes, regardless of errors
3 1 $Filter::Cleanup::VERSION = '0.03';
4  
5 1 ▶use 5.012;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 1 ▶use Keyword::Declare;
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 1 our $CLEANUP;
11  
12 1 ▶sub import {
Subroutine import: called CC=3 SCAR=12.5
13 0 ▶ keyword cleanup (Block $cl, /\s*;\s/? $br) :then(Statement* $st='1') {
Subroutine __ANON__: called CC=1 SCAR=0.9
Subroutine __ANON__: not called CC=1 SCAR=0.9
Branch: 1 branch
BranchTrueFalseTotal
if (((caller 0)[3] // "") =~ /\b(?:un)?import\Z/u) 1 0 1
Condition50%1/2
(caller 0)[3] // ""
l!l
10
MC/DC0%0/1
(caller 0)[3] // ""
(caller 0)[3]
Truth table50%1/2
A
A= (caller 0)[3]
Aresult
11
00
14 0 qq{
15 0 local \$Filter::Cleanup::CLEANUP = Filter::Cleanup->new(sub $cl);
16 $st
17 0 };
18 0 }
19 0 }
20  
21 0 ▶sub new {
Subroutine new: called CC=1 SCAR=0.6
Pod undocumented
22 0 my ($class, $code) = @_;
23 0 bless $code, $class;
24 }
25 0  
26 0 ▶sub DESTROY {
Subroutine DESTROY: called CC=2 SCAR=7.4
27 18 my $self = shift;
28 18 ▶ if (defined $self) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $self) 18 0 18
29 18 $self->();
30 1 }
31 1 ▶}
Subroutine BEGIN: called CC=1 SCAR=0.0
32 1  
33 1 1;
34  
35 __END__
↑ Summary