line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package B::Hooks::EndOfScope::PP; |
2
|
|
|
|
|
|
|
# ABSTRACT: Execute code after a scope finished compilation - PP implementation |
3
|
|
|
|
|
|
|
|
4
|
1
|
|
|
1
|
|
52335
|
use warnings; |
|
1
|
|
|
|
|
8
|
|
|
1
|
|
|
|
|
25
|
|
5
|
1
|
|
|
1
|
|
4
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
43
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our $VERSION = '0.24'; |
8
|
|
|
|
|
|
|
|
9
|
1
|
|
|
1
|
|
5
|
use constant _PERL_VERSION => "$]"; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
168
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
BEGIN { |
12
|
1
|
50
|
|
1
|
|
5
|
if (_PERL_VERSION =~ /^5\.009/) { |
13
|
|
|
|
|
|
|
# CBA to figure out where %^H got broken and which H::U::HH is sane enough |
14
|
0
|
|
|
|
|
0
|
die "By design B::Hooks::EndOfScope does not operate in pure-perl mode on perl 5.9.X\n" |
15
|
|
|
|
|
|
|
} |
16
|
|
|
|
|
|
|
elsif (_PERL_VERSION < '5.010') { |
17
|
|
|
|
|
|
|
require B::Hooks::EndOfScope::PP::HintHash; |
18
|
|
|
|
|
|
|
*on_scope_end = \&B::Hooks::EndOfScope::PP::HintHash::on_scope_end; |
19
|
|
|
|
|
|
|
} |
20
|
|
|
|
|
|
|
else { |
21
|
1
|
|
|
|
|
332
|
require B::Hooks::EndOfScope::PP::FieldHash; |
22
|
1
|
|
|
|
|
36
|
*on_scope_end = \&B::Hooks::EndOfScope::PP::FieldHash::on_scope_end; |
23
|
|
|
|
|
|
|
} |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
|
26
|
1
|
|
|
|
|
7
|
use Sub::Exporter::Progressive 0.001006 -setup => { |
27
|
|
|
|
|
|
|
exports => ['on_scope_end'], |
28
|
|
|
|
|
|
|
groups => { default => ['on_scope_end'] }, |
29
|
1
|
|
|
1
|
|
359
|
}; |
|
1
|
|
|
|
|
846
|
|
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
sub __invoke_callback { |
32
|
1
|
|
|
1
|
|
1
|
local $@; |
33
|
1
|
50
|
|
|
|
2
|
eval { $_[0]->(); 1 } or do { |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
5
|
|
34
|
0
|
|
|
|
|
|
my $err = $@; |
35
|
0
|
|
|
|
|
|
require Carp; |
36
|
0
|
|
|
|
|
|
Carp::cluck( (join ' ', |
37
|
|
|
|
|
|
|
'A scope-end callback raised an exception, which can not be propagated when', |
38
|
|
|
|
|
|
|
'B::Hooks::EndOfScope operates in pure-perl mode. Your program will CONTINUE', |
39
|
|
|
|
|
|
|
'EXECUTION AS IF NOTHING HAPPENED AFTER THIS WARNING. Below is the complete', |
40
|
|
|
|
|
|
|
'exception text, followed by a stack-trace of the callback execution:', |
41
|
|
|
|
|
|
|
) . "\n\n$err\n\r" ); |
42
|
|
|
|
|
|
|
|
43
|
0
|
0
|
|
|
|
|
sleep 1 if -t *STDERR; # maybe a bad idea...? |
44
|
|
|
|
|
|
|
}; |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
1; |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
__END__ |