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