| 1 | package SQL::Translator::Role::Debug; | ||||||||||||||||||||
| 2 | 71 | ▶ | use Moo::Role; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 3 | 71 | ▶ | use Sub::Quote qw(quote_sub); | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 4 | |||||||||||||||||||||
| 5 | 71 | 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 | 140 | ▶ | sub _build__DEBUG { | ||||||||||||||||||
|
Subroutine
_build__DEBUG: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 15 | 140 | my ($self) = @_; | |||||||||||||||||||
| 16 | 140 | my $class = ref $self; | |||||||||||||||||||
| 17 | 71 | ▶ | no strict 'refs'; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 18 | 140 | return ${"${class}::DEBUG"}; | |||||||||||||||||||
| 19 | } | ||||||||||||||||||||
| 20 | |||||||||||||||||||||
| 21 | 1039 | ▶ | around debugging => sub { | ||||||||||||||||||
|
Subroutine
__ANON__: called CC=3 SCAR=11.0
| |||||||||||||||||||||
| 22 | 1039 | my ($orig, $self) = (shift, shift); | |||||||||||||||||||
| 23 | |||||||||||||||||||||
| 24 | # Emulate horrible Class::Base API | ||||||||||||||||||||
| 25 | 1039 | ▶ | unless (ref $self) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 26 | 71 | ▶ | my $dbgref = do { no strict 'refs'; \${"${self}::DEBUG"} }; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 27 | 200 | ▶ | $$dbgref = $_[0] if @_; | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 28 | 200 | return $$dbgref; | |||||||||||||||||||
| 29 | } | ||||||||||||||||||||
| 30 | 839 | return $self->$orig(@_); | |||||||||||||||||||
| 31 | 71 | }; | |||||||||||||||||||
| 32 | |||||||||||||||||||||
| 33 | 919 | ▶ | sub debug { | ||||||||||||||||||
|
Subroutine
debug: called CC=3 SCAR=16.5
Pod
undocumented
| |||||||||||||||||||||
| 34 | 919 | my $self = shift; | |||||||||||||||||||
| 35 | |||||||||||||||||||||
| 36 | 919 | ▶ | return unless $self->debugging; | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 37 | |||||||||||||||||||||
| 38 | 0 | ▶ | print STDERR '[', (ref $self || $self), '] ', @_, "\n"; | ||||||||||||||||||
|
Condition0%0/3
ref $self || $self
MC/DC0%0/2
ref $self || $self
ref $self
$self
Truth table0%0/3
A || B
A= ref $selfB= $self
| |||||||||||||||||||||
| 39 | } | ||||||||||||||||||||
| 40 | |||||||||||||||||||||
| 41 | 71 | 1; | |||||||||||||||||||