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