line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Scope::OnExit::Wrap; |
2
|
|
|
|
|
|
|
|
3
|
3
|
|
|
3
|
|
22947
|
use warnings; |
|
3
|
|
|
|
|
7
|
|
|
3
|
|
|
|
|
97
|
|
4
|
3
|
|
|
3
|
|
12
|
use strict; |
|
3
|
|
|
|
|
4
|
|
|
3
|
|
|
|
|
85
|
|
5
|
|
|
|
|
|
|
|
6
|
3
|
|
|
3
|
|
15
|
use base 'Exporter'; |
|
3
|
|
|
|
|
13
|
|
|
3
|
|
|
|
|
737
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
our $VERSION = '0.02'; |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
our @EXPORT = qw(on_scope_exit); |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
our $_backend; |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
if (!$ENV{SCOPE_ONEXIT_WRAP_PP} && eval { require Scope::OnExit }) { |
15
|
|
|
|
|
|
|
Scope::OnExit->import; |
16
|
|
|
|
|
|
|
$_backend = 'XS'; |
17
|
|
|
|
|
|
|
} else { |
18
|
|
|
|
|
|
|
eval <<'EOT'; |
19
|
|
|
|
|
|
|
sub on_scope_exit (&) { |
20
|
|
|
|
|
|
|
my ($code) = @_; |
21
|
|
|
|
|
|
|
bless \$code, __PACKAGE__ |
22
|
|
|
|
|
|
|
} |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
sub DESTROY { |
25
|
|
|
|
|
|
|
my $self = shift; |
26
|
|
|
|
|
|
|
$$self->(); |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
EOT |
30
|
|
|
|
|
|
|
die $@ if $@; |
31
|
|
|
|
|
|
|
$_backend = 'PP'; |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
'ok' |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
__END__ |