line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
108
|
|
|
108
|
|
2073
|
use 5.010001; |
|
108
|
|
|
|
|
477
|
|
2
|
108
|
|
|
108
|
|
553
|
use strict; |
|
108
|
|
|
|
|
233
|
|
|
108
|
|
|
|
|
2306
|
|
3
|
108
|
|
|
108
|
|
533
|
use warnings; |
|
108
|
|
|
|
|
212
|
|
|
108
|
|
|
|
|
4773
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
use Mite::Miteception -role, -all; |
6
|
108
|
|
|
108
|
|
609
|
|
|
108
|
|
|
|
|
225
|
|
|
108
|
|
|
|
|
829
|
|
7
|
|
|
|
|
|
|
our $AUTHORITY = 'cpan:TOBYINK'; |
8
|
|
|
|
|
|
|
our $VERSION = '0.010008'; |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
requires qw( |
11
|
|
|
|
|
|
|
linear_isa |
12
|
|
|
|
|
|
|
_get_parent |
13
|
|
|
|
|
|
|
_compile_meta |
14
|
|
|
|
|
|
|
); |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
around compilation_stages => sub { |
17
|
|
|
|
|
|
|
my ( $next, $self ) = ( shift, shift ); |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
# Check if we are inheriting from a Mite class in this project |
20
|
|
|
|
|
|
|
my $inherit_from_mite = do { |
21
|
|
|
|
|
|
|
# First parent |
22
|
|
|
|
|
|
|
my $first_isa = do { |
23
|
|
|
|
|
|
|
my @isa = $self->linear_isa; |
24
|
|
|
|
|
|
|
shift @isa; |
25
|
|
|
|
|
|
|
shift @isa; |
26
|
|
|
|
|
|
|
}; |
27
|
|
|
|
|
|
|
!! ( $first_isa and $self->_get_parent( $first_isa ) ); |
28
|
|
|
|
|
|
|
}; |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
my @stages = $self->$next( @_ ); |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
# Only need these stages if not already inheriting from Mite |
33
|
|
|
|
|
|
|
push @stages, qw( |
34
|
|
|
|
|
|
|
_compile_destroy |
35
|
|
|
|
|
|
|
) unless $inherit_from_mite; |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
return @stages; |
38
|
|
|
|
|
|
|
}; |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
my $self = shift; |
41
|
|
|
|
|
|
|
sprintf <<'CODE', $self->_compile_meta( '$class', '$self' ); |
42
|
93
|
|
|
93
|
|
219
|
# Destructor should call DEMOLISH methods |
43
|
93
|
|
|
|
|
390
|
sub DESTROY { |
44
|
|
|
|
|
|
|
my $self = shift; |
45
|
|
|
|
|
|
|
my $class = ref( $self ) || $self; |
46
|
|
|
|
|
|
|
my $meta = %s; |
47
|
|
|
|
|
|
|
my $in_global_destruction = defined ${^GLOBAL_PHASE} |
48
|
|
|
|
|
|
|
? ${^GLOBAL_PHASE} eq 'DESTRUCT' |
49
|
|
|
|
|
|
|
: Devel::GlobalDestruction::in_global_destruction(); |
50
|
|
|
|
|
|
|
for my $demolisher ( @{ $meta->{DEMOLISH} || [] } ) { |
51
|
|
|
|
|
|
|
my $e = do { |
52
|
|
|
|
|
|
|
local ( $?, $@ ); |
53
|
|
|
|
|
|
|
eval { $demolisher->( $self, $in_global_destruction ) }; |
54
|
|
|
|
|
|
|
$@; |
55
|
|
|
|
|
|
|
}; |
56
|
|
|
|
|
|
|
no warnings 'misc'; # avoid (in cleanup) warnings |
57
|
|
|
|
|
|
|
die $e if $e; # rethrow |
58
|
|
|
|
|
|
|
} |
59
|
|
|
|
|
|
|
return; |
60
|
|
|
|
|
|
|
} |
61
|
|
|
|
|
|
|
CODE |
62
|
|
|
|
|
|
|
} |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
1; |