line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Text::MicroMason::Debug; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
577
|
use strict; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
29
|
|
4
|
1
|
|
|
1
|
|
19
|
use Carp; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
70
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
###################################################################### |
7
|
|
|
|
|
|
|
|
8
|
1
|
|
|
1
|
|
6
|
use vars qw( %Defaults ); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
654
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
sub defaults { |
11
|
1
|
|
|
1
|
0
|
5
|
(shift)->NEXT('defaults'), debug => { default => 1 }, |
12
|
|
|
|
|
|
|
} |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
###################################################################### |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
sub debug_msg { |
17
|
6
|
|
|
6
|
1
|
13
|
my $self = shift; |
18
|
6
|
|
|
|
|
10
|
my $type = shift; |
19
|
|
|
|
|
|
|
my $flag = ( ! ref $self->{debug} ) ? $self->{debug} : |
20
|
|
|
|
|
|
|
exists( $self->{debug}{$type} ) ? $self->{debug}{$type} : |
21
|
6
|
50
|
|
|
|
23
|
$self->{debug}{'default'}; |
|
|
50
|
|
|
|
|
|
22
|
6
|
50
|
|
|
|
17
|
if ( $flag ) { |
23
|
0
|
0
|
|
|
|
0
|
warn "MicroMason Debug $type: " . ( ( @_ == 1 ) ? $_[0] : join( ', ', map Text::MicroMason::Base::_printable(), @_ ) ) . "\n"; |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
|
26
|
6
|
100
|
|
|
|
19
|
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
|
54
|
my $self = (shift)->NEXT( 'create', @_ ); |
39
|
1
|
|
|
|
|
15
|
$self->debug_msg( 'create', ref($self), %$self ); |
40
|
1
|
|
|
|
|
9
|
return $self; |
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
sub prepare { |
44
|
1
|
|
|
1
|
0
|
3
|
my ( $self, $src_type, $src_data ) = @_; |
45
|
1
|
|
|
|
|
3
|
my @result = $self->NEXT( 'prepare', $src_type, $src_data ); |
46
|
1
|
50
|
33
|
|
|
5
|
if ( scalar @result > 3 or grep { $result[$_] ne $_[$_] } 0 .. 2 ){ |
|
3
|
|
|
|
|
26
|
|
47
|
0
|
|
|
|
|
0
|
$self->debug_msg( 'prepare', @result ); |
48
|
|
|
|
|
|
|
} |
49
|
1
|
|
|
|
|
4
|
return @result; |
50
|
|
|
|
|
|
|
} |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
sub interpret { |
53
|
1
|
|
|
1
|
0
|
3
|
my $self = shift; |
54
|
1
|
|
|
|
|
3
|
$self->debug_msg( 'interpret', @_ ); |
55
|
1
|
|
|
|
|
3
|
$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
|
2
|
my $self = shift; |
67
|
1
|
|
|
|
|
3
|
$self->debug_msg( 'source', @_ ); |
68
|
1
|
|
|
|
|
4
|
$self->debug_msg( 'lex', $self->NEXT( 'lex', @_ ) ); |
69
|
|
|
|
|
|
|
} |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
sub assemble { |
72
|
1
|
|
|
1
|
0
|
2
|
my $self = shift; |
73
|
1
|
|
|
|
|
4
|
$self->debug_msg( 'assemble', $self->NEXT( 'assemble', @_ ) ); |
74
|
|
|
|
|
|
|
} |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
sub eval_sub { |
77
|
1
|
|
|
1
|
0
|
3
|
my $self = shift; |
78
|
1
|
|
|
|
|
5
|
$self->debug_msg( 'eval', @_ ); |
79
|
1
|
|
|
|
|
4
|
$self->NEXT( 'eval_sub', @_ ) |
80
|
|
|
|
|
|
|
} |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
###################################################################### |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
1; |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
__END__ |