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