line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Filter::Simple::Compile; |
2
|
|
|
|
|
|
|
$Filter::Simple::Compile::VERSION = '0.02'; |
3
|
|
|
|
|
|
|
|
4
|
3
|
|
|
3
|
|
23804
|
use strict; |
|
3
|
|
|
|
|
7
|
|
|
3
|
|
|
|
|
110
|
|
5
|
3
|
|
|
3
|
|
18
|
use warnings; |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
96
|
|
6
|
3
|
|
|
3
|
|
53
|
use 5.006; |
|
3
|
|
|
|
|
14
|
|
|
3
|
|
|
|
|
118
|
|
7
|
3
|
|
|
3
|
|
5282
|
use Module::Compile 0.17 (); |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
sub import { |
10
|
|
|
|
|
|
|
my $class = shift; |
11
|
|
|
|
|
|
|
my $code = shift; |
12
|
|
|
|
|
|
|
my $pkg = caller; |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
no strict 'refs'; |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
push @{"$pkg\::ISA"} => 'Module::Compile'; |
17
|
|
|
|
|
|
|
*{"$pkg\::FILTER"} = \&FILTER; |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
($code and ref($code) eq 'CODE') or return; |
20
|
|
|
|
|
|
|
_setup_filter($pkg, $code); |
21
|
|
|
|
|
|
|
} |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
sub unimport { |
24
|
|
|
|
|
|
|
my $pkg = caller; |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
no strict 'refs'; |
27
|
|
|
|
|
|
|
*{"$pkg\::pmc_use_means_no"} = sub { 1 }; |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
goto &{$_[0]->can('import')}; |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
sub FILTER (&) { |
33
|
|
|
|
|
|
|
my $pkg = caller; |
34
|
|
|
|
|
|
|
my $code = shift; |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
_setup_filter($pkg, $code); |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
sub _setup_filter { |
40
|
|
|
|
|
|
|
my ($pkg, $code) = @_; |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
no strict 'refs'; |
43
|
|
|
|
|
|
|
*{"$pkg\::pmc_compile"} = sub { |
44
|
|
|
|
|
|
|
local $_; |
45
|
|
|
|
|
|
|
(undef, $_, undef) = @_; |
46
|
|
|
|
|
|
|
$code->(); |
47
|
|
|
|
|
|
|
return $_; |
48
|
|
|
|
|
|
|
}; |
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
1; |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
__END__ |