Commit | Line | Data |
---|---|---|
13e18b1b | 1 | package Devel::REPL::Plugin::Refresh; |
2 | ||
3 | use Moose::Role; | |
4 | use namespace::clean -except => [ 'meta' ]; | |
5 | use Module::Refresh; | |
6 | ||
7 | # before evaluating the code, ask Module::Refresh to refresh | |
8 | # the modules that have changed | |
9 | around 'eval' => sub { | |
10 | my $orig = shift; | |
11 | my ($self, $line) = @_; | |
12 | ||
13 | # first refresh the changed modules | |
14 | Module::Refresh->refresh; | |
15 | ||
16 | # the eval the code | |
17 | return $self->$orig($line); | |
18 | }; | |
19 | ||
20 | 1; |