blib/lib/Text/MicroMason/Debug.pm

filter: Statementstmt 81.4% 35 / 43 Branchbran 50.0% 6 / 12 Conditioncond 33.3% 1 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 84.6% 11 / 13 Podpod 10.0% 1 / 10 totaltotal 65.0% 54 / 83 CC 8 SCAR 12.6
CC
8
Cov
72%
debug_msg
7.9
prepare
3.4
new
2.0
CRAP 3.5
« blib/lib/Text/MicroMason/Cache/File.pm ↑ Summary blib/lib/Text/MicroMason/TemplatePath.pm »
1 package Text::MicroMason::Debug;
2  
3 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 ######################################################################
7  
8 1 ▶use vars qw( %Defaults );
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 1 ▶sub defaults {
Subroutine defaults: called CC=1 SCAR=0.0
Pod undocumented
11 1 (shift)->NEXT('defaults'), debug => { default => 1 },
12 }
13  
14 ######################################################################
15  
16 6 ▶sub debug_msg {
Subroutine debug_msg: called CC=6 SCAR=20.7
Pod documented
17 6 my $self = shift;
18 6 my $type = shift;
19 my $flag = ( ! ref $self->{debug} ) ? $self->{debug} :
20 exists( $self->{debug}{$type} ) ? $self->{debug}{$type} :
21 6 ▶ $self->{debug}{'default'};
Branch: 2 branches
BranchTrueFalseTotal
!ref($self->{'debug'}) ? : 0 6 6
exists $self->{'debug'}{$type} ? : 0 6 6
22 6 ▶ if ( $flag ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($flag) 0 6 6
23 0 ▶ warn "MicroMason Debug $type: " . ( ( @_ == 1 ) ? $_[0] : join( ', ', map Text::MicroMason::Base::_printable(), @_ ) ) . "\n";
Branch: 1 branch
BranchTrueFalseTotal
@_ == 1 ? : 0 0 0
24 }
25  
26 6 ▶ wantarray ? @_ : $_[0];
Branch: 1 branch
BranchTrueFalseTotal
wantarray ? : 1 5 6
27 }
28  
29 ######################################################################
30  
31 0 ▶sub new {
Subroutine new: not called CC=1 SCAR=6.9
Pod undocumented
32 0 my $self = shift;
33 0 $self->debug_msg( 'new', $self, @_ );
34 0 $self->NEXT( 'new', @_ );
35 }
36  
37 1 ▶sub create {
Subroutine create: called CC=1 SCAR=0.0
Pod undocumented
38 1 my $self = (shift)->NEXT( 'create', @_ );
39 1 $self->debug_msg( 'create', ref($self), %$self );
40 1 return $self;
41 }
42  
43 1 ▶sub prepare {
Subroutine prepare: called CC=3 SCAR=12.3
Pod undocumented
44 1 my ( $self, $src_type, $src_data ) = @_;
45 1 my @result = $self->NEXT( 'prepare', $src_type, $src_data );
46 1 ▶ if ( scalar @result > 3 or grep { $result[$_] ne $_[$_] } 0 .. 2 ){
Branch: 1 branch
BranchTrueFalseTotal
if (scalar @result > 3 or grep {$result[$_] ne $_[$_];} 0..2) 0 1 1
Condition33%1/3
scalar @result > 3 or grep {$result[$_] ne $_[$_];} 0..2
l!l&&r!l&&!r
001
MC/DC0%0/2
scalar @result > 3 or grep {$result[$_] ne $_[$_];} 0..2
scalar @result > 3 grep {$result[$_] ne $_[$_];} 0..2
Truth table33%1/3
A or B
A= scalar @result > 3B= grep {$result[$_] ne $_[$_];} 0..2
ABresult
1X1
011
000
47 0 $self->debug_msg( 'prepare', @result );
48 }
49 1 return @result;
50 }
51  
52 1 ▶sub interpret {
Subroutine interpret: called CC=1 SCAR=0.0
Pod undocumented
53 1 my $self = shift;
54 1 $self->debug_msg( 'interpret', @_ );
55 1 $self->NEXT( 'interpret', @_ )
56 }
57  
58 # $contents = $mason->read_file( $filename );
59 0 ▶sub read_file {
Subroutine read_file: not called CC=1 SCAR=6.9
Pod undocumented
60 0 my $self = shift;
61 0 $self->debug_msg( 'read', "Opening file '$_[0]'" );
62 0 $self->NEXT( 'read_file', @_ )
63 }
64  
65 1 ▶sub lex {
Subroutine lex: called CC=1 SCAR=0.0
Pod undocumented
66 1 my $self = shift;
67 1 $self->debug_msg( 'source', @_ );
68 1 $self->debug_msg( 'lex', $self->NEXT( 'lex', @_ ) );
69 }
70  
71 1 ▶sub assemble {
Subroutine assemble: called CC=1 SCAR=0.0
Pod undocumented
72 1 my $self = shift;
73 1 $self->debug_msg( 'assemble', $self->NEXT( 'assemble', @_ ) );
74 }
75  
76 1 ▶sub eval_sub {
Subroutine eval_sub: called CC=1 SCAR=0.0
Pod undocumented
77 1 my $self = shift;
78 1 $self->debug_msg( 'eval', @_ );
79 1 $self->NEXT( 'eval_sub', @_ )
80 }
81  
82 ######################################################################
83  
84 1 1;
85  
86 __END__
« blib/lib/Text/MicroMason/Cache/File.pm ↑ Summary blib/lib/Text/MicroMason/TemplatePath.pm »