| 1 | package Tak::ModuleLoader; | ||
| 2 | |||
| 3 | 1 | ▶ | use Tak::ModuleLoader::Hook; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 4 | 1 | ▶ | use Moo; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 5 | |||
| 6 | 1 | with 'Tak::Role::Service'; | |
| 7 | |||
| 8 | 1 | has module_sender => (is => 'ro', required => 1); | |
| 9 | |||
| 10 | 1 | has inc_hook => (is => 'lazy'); | |
| 11 | |||
| 12 | sub _build_inc_hook { | ||
| 13 | 0 | ▶ | my ($self) = @_; |
|
Subroutine
_build_inc_hook: not called CC=1 SCAR=6.9
| |||
| 14 | 0 | Tak::ModuleLoader::Hook->new(sender => $self->module_sender); | |
| 15 | } | ||
| 16 | |||
| 17 | sub handle_enable { | ||
| 18 | 0 | ▶ | my ($self) = @_; |
|
Subroutine
handle_enable: not called CC=1 SCAR=6.9
Pod
undocumented
| |||
| 19 | 0 | push @INC, $self->inc_hook; | |
| 20 | 0 | return 'enabled'; | |
| 21 | } | ||
| 22 | |||
| 23 | sub handle_disable { | ||
| 24 | 0 | ▶ | my ($self) = @_; |
|
Subroutine
handle_disable: not called CC=1 SCAR=6.9
Pod
undocumented
| |||
| 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 | ▶ | my ($self) = @_; |
|
Subroutine
DEMOLISH: not called CC=1 SCAR=6.9
Pod
undocumented
| |||
| 32 | 0 | $self->handle_disable; | |
| 33 | } | ||
| 34 | |||
| 35 | 1 | 1; | |