line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Text::MicroMason::Debug; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
427
|
use strict; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
22
|
|
4
|
1
|
|
|
1
|
|
3
|
use Carp; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
47
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
###################################################################### |
7
|
|
|
|
|
|
|
|
8
|
1
|
|
|
1
|
|
3
|
use vars qw( %Defaults ); |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
383
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
sub defaults { |
11
|
1
|
|
|
1
|
0
|
3
|
(shift)->NEXT('defaults'), debug => { default => 1 }, |
12
|
|
|
|
|
|
|
} |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
###################################################################### |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
sub debug_msg { |
17
|
6
|
|
|
6
|
1
|
18
|
my $self = shift; |
18
|
6
|
|
|
|
|
5
|
my $type = shift; |
19
|
|
|
|
|
|
|
my $flag = ( ! ref $self->{debug} ) ? $self->{debug} : |
20
|
|
|
|
|
|
|
exists( $self->{debug}{$type} ) ? $self->{debug}{$type} : |
21
|
6
|
50
|
|
|
|
17
|
$self->{debug}{'default'}; |
|
|
50
|
|
|
|
|
|
22
|
6
|
50
|
|
|
|
10
|
if ( $flag ) { |
23
|
0
|
0
|
|
|
|
0
|
warn "MicroMason Debug $type: " . ( ( @_ == 1 ) ? $_[0] : join( ', ', map Text::MicroMason::Base::_printable(), @_ ) ) . "\n"; |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
|
26
|
6
|
100
|
|
|
|
12
|
wantarray ? @_ : $_[0]; |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
###################################################################### |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
sub new { |
32
|
0
|
|
|
0
|
0
|
0
|
my $self = shift; |
33
|
0
|
|
|
|
|
0
|
$self->debug_msg( 'new', $self, @_ ); |
34
|
0
|
|
|
|
|
0
|
$self->NEXT( 'new', @_ ); |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
sub create { |
38
|
1
|
|
|
1
|
0
|
33
|
my $self = (shift)->NEXT( 'create', @_ ); |
39
|
1
|
|
|
|
|
8
|
$self->debug_msg( 'create', ref($self), %$self ); |
40
|
1
|
|
|
|
|
4
|
return $self; |
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
sub prepare { |
44
|
1
|
|
|
1
|
0
|
2
|
my ( $self, $src_type, $src_data ) = @_; |
45
|
1
|
|
|
|
|
4
|
my @result = $self->NEXT( 'prepare', $src_type, $src_data ); |
46
|
1
|
50
|
33
|
|
|
4
|
if ( scalar @result > 3 or grep { $result[$_] ne $_[$_] } 0 .. 2 ){ |
|
3
|
|
|
|
|
8
|
|
47
|
0
|
|
|
|
|
0
|
$self->debug_msg( 'prepare', @result ); |
48
|
|
|
|
|
|
|
} |
49
|
1
|
|
|
|
|
3
|
return @result; |
50
|
|
|
|
|
|
|
} |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
sub interpret { |
53
|
1
|
|
|
1
|
0
|
1
|
my $self = shift; |
54
|
1
|
|
|
|
|
2
|
$self->debug_msg( 'interpret', @_ ); |
55
|
1
|
|
|
|
|
2
|
$self->NEXT( 'interpret', @_ ) |
56
|
|
|
|
|
|
|
} |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
# $contents = $mason->read_file( $filename ); |
59
|
|
|
|
|
|
|
sub read_file { |
60
|
0
|
|
|
0
|
0
|
0
|
my $self = shift; |
61
|
0
|
|
|
|
|
0
|
$self->debug_msg( 'read', "Opening file '$_[0]'" ); |
62
|
0
|
|
|
|
|
0
|
$self->NEXT( 'read_file', @_ ) |
63
|
|
|
|
|
|
|
} |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
sub lex { |
66
|
1
|
|
|
1
|
0
|
1
|
my $self = shift; |
67
|
1
|
|
|
|
|
1
|
$self->debug_msg( 'source', @_ ); |
68
|
1
|
|
|
|
|
2
|
$self->debug_msg( 'lex', $self->NEXT( 'lex', @_ ) ); |
69
|
|
|
|
|
|
|
} |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
sub assemble { |
72
|
1
|
|
|
1
|
0
|
1
|
my $self = shift; |
73
|
1
|
|
|
|
|
3
|
$self->debug_msg( 'assemble', $self->NEXT( 'assemble', @_ ) ); |
74
|
|
|
|
|
|
|
} |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
sub eval_sub { |
77
|
1
|
|
|
1
|
0
|
1
|
my $self = shift; |
78
|
1
|
|
|
|
|
2
|
$self->debug_msg( 'eval', @_ ); |
79
|
1
|
|
|
|
|
3
|
$self->NEXT( 'eval_sub', @_ ) |
80
|
|
|
|
|
|
|
} |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
###################################################################### |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
1; |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
__END__ |