blib/lib/SQL/Translator/Role/Debug.pm

filter: Statementstmt 96.6% 29 / 30 Branchbran 66.6% 4 / 6 Conditioncond 0.0% 0 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 100% 7 / 7 Podpod 0.0% 0 / 1 totaltotal 81.6% 40 / 49 SCAR 16.3
CC
5
Cov
85%
debug
5.2
__ANON__
3.0
BEGIN
1.0
CRAP 5.1
« blib/lib/SQL/Translator/Producer/Latex.pm ↑ Summary blib/lib/SQL/Translator/Schema/Role/Compare.pm »
1 package SQL::Translator::Role::Debug;
2 70 ▶use Moo::Role;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 70 ▶use Sub::Quote qw(quote_sub);
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 70 has _DEBUG => (
6 is => 'rw',
7 accessor => 'debugging',
8 init_arg => 'debugging',
9 coerce => quote_sub(q{ $_[0] ? 1 : 0 }),
10 lazy => 1,
11 builder => 1,
12 );
13  
14 sub _build__DEBUG {
15 139 ▶ my ($self) = @_;
Subroutine _build__DEBUG: called CC=1 SCAR=0.0
16 139 my $class = ref $self;
17 70 ▶ no strict 'refs';
Subroutine BEGIN: called CC=1 SCAR=0.0
18 139 return ${"${class}::DEBUG"};
19 }
20  
21 around debugging => sub {
22 1032 ▶ my ($orig, $self) = (shift, shift);
Subroutine __ANON__: called CC=3 SCAR=11.0
23  
24 # Emulate horrible Class::Base API
25 1032 ▶ unless (ref $self) {
Branch: 1 branch
BranchTrueFalseTotal
unless (ref $self) 198 834 1032
26 70 ▶ my $dbgref = do { no strict 'refs'; \${"${self}::DEBUG"} };
Subroutine BEGIN: called CC=1 SCAR=0.0
27 198 ▶ $$dbgref = $_[0] if @_;
Branch: 1 branch
BranchTrueFalseTotal
if @_ 0 198 198
28 198 return $$dbgref;
29 }
30 834 return $self->$orig(@_);
31 70 };
32  
33 sub debug {
34 913 ▶ my $self = shift;
Subroutine debug: called CC=3 SCAR=16.5
Pod undocumented
35  
36 913 ▶ return unless $self->debugging;
Branch: 1 branch
BranchTrueFalseTotal
unless $self->debugging 913 0 913
37  
38 0 ▶ print STDERR '[', (ref $self || $self), '] ', @_, "\n";
Condition0%0/3
ref $self || $self
l!l&&r!l&&!r
000
MC/DC0%0/2
ref $self || $self
ref $self $self
Truth table0%0/3
A || B
A= ref $selfB= $self
ABresult
1X1
011
000
39 }
40  
41 70 1;
« blib/lib/SQL/Translator/Producer/Latex.pm ↑ Summary blib/lib/SQL/Translator/Schema/Role/Compare.pm »