line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
109
|
|
|
109
|
|
4545
|
use 5.010001; |
|
109
|
|
|
|
|
414
|
|
2
|
109
|
|
|
109
|
|
658
|
use strict; |
|
109
|
|
|
|
|
269
|
|
|
109
|
|
|
|
|
2520
|
|
3
|
109
|
|
|
109
|
|
619
|
use warnings; |
|
109
|
|
|
|
|
293
|
|
|
109
|
|
|
|
|
5462
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
use Mite::Miteception -role, -all; |
6
|
109
|
|
|
109
|
|
753
|
|
|
109
|
|
|
|
|
275
|
|
|
109
|
|
|
|
|
940
|
|
7
|
|
|
|
|
|
|
our $AUTHORITY = 'cpan:TOBYINK'; |
8
|
|
|
|
|
|
|
our $VERSION = '0.011000'; |
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
|
90
|
|
|
90
|
|
274
|
# Destructor should call DEMOLISH methods |
43
|
90
|
|
|
|
|
482
|
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; |