line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Text::MicroMason::PostProcess; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
479
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
22
|
|
4
|
1
|
|
|
1
|
|
3
|
use Carp; |
|
1
|
|
|
|
|
14
|
|
|
1
|
|
|
|
|
249
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
###################################################################### |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
sub assembler_rules { |
9
|
10
|
|
|
10
|
0
|
13
|
my $self = shift; |
10
|
10
|
|
|
|
|
27
|
my %rules = $self->NEXT('assembler_rules', @_); |
11
|
10
|
|
|
|
|
38
|
$rules{return_output} = "\$m->post_process( $rules{return_output} )"; |
12
|
10
|
|
|
|
|
59
|
%rules; |
13
|
|
|
|
|
|
|
} |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
sub post_processors { |
16
|
14
|
|
|
14
|
1
|
18
|
my $self = shift; |
17
|
14
|
|
|
|
|
23
|
my $funcs = $self->{post_process}; |
18
|
14
|
100
|
|
|
|
41
|
my @funcs = ref($funcs) eq 'ARRAY' ? @$funcs : $funcs ? $funcs : (); |
|
|
100
|
|
|
|
|
|
19
|
14
|
100
|
|
|
|
29
|
if ( scalar @_ ) { |
20
|
4
|
50
|
33
|
|
|
24
|
@funcs = ( $#_ == 0 and ref($_[0]) eq 'ARRAY' ) ? @{ $_[0] } : (@funcs, @_); |
|
0
|
|
|
|
|
0
|
|
21
|
4
|
|
|
|
|
13
|
$self->{post_process} = [ @funcs ]; |
22
|
|
|
|
|
|
|
} |
23
|
14
|
|
|
|
|
36
|
return @funcs; |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
sub post_process { |
27
|
10
|
|
|
10
|
1
|
169
|
my $self = shift; |
28
|
10
|
|
|
|
|
26
|
local $_ = shift; |
29
|
10
|
|
|
|
|
21
|
foreach my $func ( $self->post_processors ) { |
30
|
13
|
|
|
|
|
45
|
my $p = prototype($func); |
31
|
13
|
100
|
66
|
|
|
32
|
if ( defined $p and ! length $p ) { |
32
|
2
|
|
|
|
|
7
|
&$func; |
33
|
|
|
|
|
|
|
} else { |
34
|
11
|
|
|
|
|
25
|
$_ = &$func( $_ ); |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
} |
37
|
10
|
|
|
|
|
217
|
$_; |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
###################################################################### |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
1; |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
__END__ |