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