line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Class::Unload; |
2
|
|
|
|
|
|
|
# ABSTRACT: Unload a class |
3
|
|
|
|
|
|
|
$Class::Unload::VERSION = '0.11'; |
4
|
2
|
|
|
2
|
|
28833
|
use warnings; |
|
2
|
|
|
1
|
|
6
|
|
|
2
|
|
|
|
|
58
|
|
|
1
|
|
|
|
|
16919
|
|
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
36
|
|
5
|
2
|
|
|
2
|
|
9
|
use strict; |
|
2
|
|
|
1
|
|
3
|
|
|
2
|
|
|
|
|
38
|
|
|
1
|
|
|
|
|
7
|
|
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
28
|
|
6
|
2
|
|
|
2
|
|
8
|
no strict 'refs'; # we're fiddling with the symbol table |
|
2
|
|
|
1
|
|
6
|
|
|
2
|
|
|
|
|
54
|
|
|
1
|
|
|
|
|
7
|
|
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
25
|
|
7
|
|
|
|
|
|
|
|
8
|
2
|
|
|
2
|
|
856
|
use Class::Inspector; |
|
2
|
|
|
1
|
|
5138
|
|
|
2
|
|
|
|
|
331
|
|
|
1
|
|
|
|
|
6
|
|
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
249
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub unload { |
12
|
2
|
|
|
2
|
1
|
2812
|
my ($self, $class) = @_; |
|
5
|
|
|
5
|
|
4450
|
|
13
|
|
|
|
|
|
|
|
14
|
2
|
50
|
|
|
|
9
|
return unless Class::Inspector->loaded( $class ); |
|
5
|
100
|
|
|
|
17
|
|
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
# Flush inheritance caches |
17
|
2
|
|
|
|
|
83
|
@{$class . '::ISA'} = (); |
|
2
|
|
|
|
|
20
|
|
|
4
|
|
|
|
|
97
|
|
|
4
|
|
|
|
|
36
|
|
18
|
|
|
|
|
|
|
|
19
|
2
|
|
|
|
|
7
|
my $symtab = $class.'::'; |
|
4
|
|
|
|
|
12
|
|
20
|
|
|
|
|
|
|
# Delete all symbols except other namespaces |
21
|
2
|
|
|
|
|
7
|
for my $symbol (keys %$symtab) { |
|
4
|
|
|
|
|
12
|
|
22
|
9
|
50
|
|
|
|
22
|
next if $symbol =~ /\A[^:]+::\z/; |
|
14
|
100
|
|
|
|
37
|
|
23
|
9
|
|
|
|
|
38
|
delete $symtab->{$symbol}; |
|
12
|
|
|
|
|
47
|
|
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
|
26
|
2
|
|
|
|
|
16
|
my $inc_file = join( '/', split /(?:'|::)/, $class ) . '.pm'; |
|
4
|
|
|
|
|
23
|
|
27
|
2
|
|
|
|
|
6
|
delete $INC{ $inc_file }; |
|
4
|
|
|
|
|
12
|
|
28
|
|
|
|
|
|
|
|
29
|
2
|
50
|
|
|
|
6
|
if (Class::Inspector->loaded('Class::MOP')) { |
|
4
|
50
|
|
|
|
9
|
|
30
|
0
|
|
|
|
|
0
|
Class::MOP::remove_metaclass_by_name($class); |
|
0
|
|
|
|
|
0
|
|
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
|
33
|
2
|
|
|
|
|
124
|
return 1; |
|
4
|
|
|
|
|
239
|
|
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
1; # End of Class::Unload |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
__END__ |