| 1 | 2 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 2 | 2 | ▶ | use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 3 | package Devel::REPL::Plugin::Refresh; | ||
| 4 | # ABSTRACT: Reload libraries with Module::Refresh | ||
| 5 | |||
| 6 | 2 | our $VERSION = '1.003029'; | |
| 7 | |||
| 8 | 2 | ▶ | use Devel::REPL::Plugin; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 9 | 2 | ▶ | use namespace::autoclean; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 10 | 2 | ▶ | use Module::Refresh; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 11 | |||
| 12 | # before evaluating the code, ask Module::Refresh to refresh | ||
| 13 | # the modules that have changed | ||
| 14 | 0 | ▶ | around 'eval' => sub { |
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||
| 15 | 0 | my $orig = shift; | |
| 16 | 0 | my ($self, $line) = @_; | |
| 17 | |||
| 18 | # first refresh the changed modules | ||
| 19 | 0 | Module::Refresh->refresh; | |
| 20 | |||
| 21 | # the eval the code | ||
| 22 | 0 | return $self->$orig($line); | |
| 23 | 2 | }; | |
| 24 | |||
| 25 | 2 | 1; | |
| 26 | |||
| 27 | __END__ | ||