Commit | Line | Data |
13e18b1b |
1 | package Devel::REPL::Plugin::Refresh; |
2 | |
6a5409bc |
3 | use Devel::REPL::Plugin; |
aa8b7647 |
4 | use namespace::autoclean; |
13e18b1b |
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; |
cfd1094b |
21 | |
22 | __END__ |
23 | |
24 | =head1 NAME |
25 | |
26 | Devel::REPL::Plugin::Refresh - reload libraries with Module::Refresh |
27 | |
28 | =cut |
29 | |