line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Acme::Magpie; |
2
|
1
|
|
|
1
|
|
17
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
41
|
|
3
|
1
|
|
|
1
|
|
6
|
use vars qw/$VERSION %Nest %symtab/; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
97
|
|
4
|
|
|
|
|
|
|
$VERSION = '0.06'; |
5
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
5
|
use constant debug => 0; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
66
|
|
7
|
1
|
|
|
1
|
|
4
|
use Devel::Symdump; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
220
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
sub import { |
10
|
1
|
|
|
1
|
|
432
|
my $self = shift; |
11
|
1
|
|
|
|
|
2
|
my $steal_from = caller; |
12
|
1
|
|
|
|
|
41294
|
for my $sym ( sort Devel::Symdump->rnew($steal_from)->functions() ) { |
13
|
2333
|
100
|
|
|
|
6727
|
next unless $sym =~ /^\Q$steal_from/; |
14
|
28
|
|
|
|
|
36
|
print "$sym\n" if debug; |
15
|
|
|
|
|
|
|
|
16
|
28
|
100
|
|
|
|
99
|
if ( $self->shiny($sym) ) { |
17
|
1
|
|
|
|
|
3
|
print "stealing $sym\n" if debug; |
18
|
1
|
|
|
|
|
8
|
my ($pkg, $name) = $sym =~ /^(.*::)(.*)$/; |
19
|
1
|
|
|
|
|
3
|
local %symtab; |
20
|
|
|
|
|
|
|
{ |
21
|
1
|
|
|
1
|
|
5
|
no strict 'refs'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
152
|
|
|
1
|
|
|
|
|
3
|
|
22
|
1
|
|
|
|
|
2
|
*symtab = \%{ $pkg }; |
|
1
|
|
|
|
|
8
|
|
23
|
|
|
|
|
|
|
} |
24
|
1
|
|
|
|
|
24
|
$Nest{ $sym } = delete $symtab{ $name }; |
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
sub unimport { |
30
|
1
|
|
|
1
|
|
2193
|
for my $sym (sort keys %Nest) { |
31
|
1
|
|
|
|
|
7
|
my ($pkg, $name) = $sym =~ /^(.*::)(.*)$/; |
32
|
1
|
|
|
|
|
3
|
local %symtab; |
33
|
|
|
|
|
|
|
{ |
34
|
1
|
|
|
1
|
|
5
|
no strict 'refs'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
104
|
|
|
1
|
|
|
|
|
2
|
|
35
|
1
|
|
|
|
|
3
|
*symtab = \%{ $pkg }; |
|
1
|
|
|
|
|
4
|
|
36
|
|
|
|
|
|
|
} |
37
|
1
|
|
|
|
|
9
|
$symtab{ $name } = delete $Nest{ $sym }; |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
sub shiny { |
43
|
0
|
|
|
0
|
0
|
|
return rand > 0.95; |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
1; |
47
|
|
|
|
|
|
|
__END__ |