line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Tak::ModuleLoader; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
1966
|
use Tak::ModuleLoader::Hook; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
23
|
|
4
|
1
|
|
|
1
|
|
7
|
use Moo; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
5
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
with 'Tak::Role::Service'; |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
has module_sender => (is => 'ro', required => 1); |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
has inc_hook => (is => 'lazy'); |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub _build_inc_hook { |
13
|
0
|
|
|
0
|
|
|
my ($self) = @_; |
14
|
0
|
|
|
|
|
|
Tak::ModuleLoader::Hook->new(sender => $self->module_sender); |
15
|
|
|
|
|
|
|
} |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
sub handle_enable { |
18
|
0
|
|
|
0
|
0
|
|
my ($self) = @_; |
19
|
0
|
|
|
|
|
|
push @INC, $self->inc_hook; |
20
|
0
|
|
|
|
|
|
return 'enabled'; |
21
|
|
|
|
|
|
|
} |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
sub handle_disable { |
24
|
0
|
|
|
0
|
0
|
|
my ($self) = @_; |
25
|
0
|
|
|
|
|
|
my $hook = $self->inc_hook; |
26
|
0
|
|
|
|
|
|
@INC = grep $_ ne $hook, @INC; |
27
|
0
|
|
|
|
|
|
return 'disabled'; |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
sub DEMOLISH { |
31
|
0
|
|
|
0
|
0
|
|
my ($self) = @_; |
32
|
0
|
|
|
|
|
|
$self->handle_disable; |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
1; |