| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package # this is an example for install_subroutine()/uninstall_subroutine(). |
|
2
|
|
|
|
|
|
|
Sub::Exporter::Lexical; |
|
3
|
2
|
|
|
2
|
|
37943
|
use 5.008_001; |
|
|
2
|
|
|
|
|
6
|
|
|
4
|
2
|
|
|
2
|
|
7
|
use strict; |
|
|
2
|
|
|
|
|
2
|
|
|
|
2
|
|
|
|
|
27
|
|
|
5
|
2
|
|
|
2
|
|
5
|
use warnings; |
|
|
2
|
|
|
|
|
2
|
|
|
|
2
|
|
|
|
|
47
|
|
|
6
|
|
|
|
|
|
|
|
|
7
|
2
|
|
|
2
|
|
671
|
use Data::Util; |
|
|
2
|
|
|
|
|
3
|
|
|
|
2
|
|
|
|
|
86
|
|
|
8
|
2
|
|
|
2
|
|
10
|
use Carp (); |
|
|
2
|
|
|
|
|
2
|
|
|
|
2
|
|
|
|
|
502
|
|
|
9
|
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
sub import :method{ |
|
11
|
2
|
|
|
2
|
|
21
|
my $class = shift; |
|
12
|
2
|
|
|
|
|
6
|
my $exportee = caller; |
|
13
|
|
|
|
|
|
|
|
|
14
|
2
|
|
|
|
|
37
|
$class->setup_installer($exportee, @_); |
|
15
|
|
|
|
|
|
|
} |
|
16
|
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
sub setup_installer :method{ |
|
18
|
2
|
|
|
2
|
0
|
7
|
my($exporter, $exportee, %args) = @_; |
|
19
|
|
|
|
|
|
|
|
|
20
|
2
|
|
|
|
|
22
|
my $exportable_ref = Data::Util::mkopt_hash $args{exports}, 'setup', 'CODE'; |
|
21
|
|
|
|
|
|
|
|
|
22
|
2
|
|
|
|
|
4
|
while(my($name, $entity) = each %{$exportable_ref}){ |
|
|
8
|
|
|
|
|
26
|
|
|
23
|
6
|
100
|
|
|
|
14
|
unless($entity){ |
|
24
|
2
|
|
|
|
|
23
|
$exportable_ref->{$name} = Data::Util::get_code_ref($exportee, $name, -create); |
|
25
|
|
|
|
|
|
|
} |
|
26
|
|
|
|
|
|
|
} |
|
27
|
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
Data::Util::install_subroutine($exportee, import => sub :method{ |
|
29
|
2
|
|
|
2
|
|
35
|
my $class = shift; |
|
|
|
|
|
1
|
|
|
|
|
30
|
|
|
|
|
|
|
|
|
31
|
2
|
|
|
|
|
6
|
my $export_ref; |
|
32
|
2
|
50
|
|
|
|
5
|
if(@_){ |
|
33
|
0
|
|
|
|
|
0
|
$export_ref = {}; |
|
34
|
0
|
|
|
|
|
0
|
for my $name(@_){ |
|
35
|
0
|
0
|
|
|
|
0
|
$export_ref->{$name} = $exportable_ref->{$name} |
|
36
|
|
|
|
|
|
|
or Carp::croak "$name is not exportable in $exportee"; |
|
37
|
|
|
|
|
|
|
} |
|
38
|
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
} |
|
40
|
|
|
|
|
|
|
else{ |
|
41
|
2
|
|
|
|
|
3
|
$export_ref = $exportable_ref; |
|
42
|
|
|
|
|
|
|
} |
|
43
|
|
|
|
|
|
|
|
|
44
|
2
|
|
|
|
|
5
|
my $into = caller; |
|
45
|
2
|
|
|
|
|
28
|
Data::Util::install_subroutine($into, %{$export_ref}); |
|
|
2
|
|
|
|
|
14
|
|
|
46
|
|
|
|
|
|
|
|
|
47
|
2
|
|
|
|
|
6
|
$^H |= 0x020000; # HINT_LOCALIZE_HH |
|
48
|
2
|
|
50
|
|
|
32
|
my $cleaner = $^H{$exporter .'/'. $into} ||= bless [$into], $exporter; |
|
49
|
|
|
|
|
|
|
|
|
50
|
2
|
|
|
|
|
3
|
push @{$cleaner}, %{$export_ref}; |
|
|
2
|
|
|
|
|
3
|
|
|
|
2
|
|
|
|
|
7
|
|
|
51
|
|
|
|
|
|
|
|
|
52
|
2
|
|
|
|
|
203
|
return; |
|
53
|
2
|
|
|
|
|
60
|
}); |
|
54
|
|
|
|
|
|
|
} |
|
55
|
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
sub DESTROY :method{ |
|
57
|
2
|
|
|
2
|
|
8
|
my($self) = @_; |
|
58
|
|
|
|
|
|
|
|
|
59
|
2
|
|
|
|
|
2
|
Data::Util::uninstall_subroutine(@{$self}); |
|
|
2
|
|
|
|
|
1149
|
|
|
60
|
|
|
|
|
|
|
} |
|
61
|
|
|
|
|
|
|
1; |
|
62
|
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
__END__ |