Commit | Line | Data |
1716b200 |
1 | use strict; |
2 | use warnings; |
13e18b1b |
3 | package Devel::REPL::Plugin::Refresh; |
4 | |
6a5409bc |
5 | use Devel::REPL::Plugin; |
aa8b7647 |
6 | use namespace::autoclean; |
13e18b1b |
7 | use Module::Refresh; |
8 | |
9 | # before evaluating the code, ask Module::Refresh to refresh |
10 | # the modules that have changed |
11 | around 'eval' => sub { |
12 | my $orig = shift; |
13 | my ($self, $line) = @_; |
14 | |
15 | # first refresh the changed modules |
16 | Module::Refresh->refresh; |
17 | |
18 | # the eval the code |
19 | return $self->$orig($line); |
20 | }; |
21 | |
22 | 1; |
cfd1094b |
23 | |
24 | __END__ |
25 | |
26 | =head1 NAME |
27 | |
28 | Devel::REPL::Plugin::Refresh - reload libraries with Module::Refresh |
29 | |
30 | =cut |
31 | |