f3a10bdb8ffdfa27e8f6c4ae2dce221e7390d7ad
[p5sagit/Devel-REPL.git] / lib / Devel / REPL / Plugin / Refresh.pm
1 use strict;
2 use warnings;
3 package Devel::REPL::Plugin::Refresh;
4
5 use Devel::REPL::Plugin;
6 use namespace::autoclean;
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;
23
24 __END__
25
26 =head1 NAME
27
28 Devel::REPL::Plugin::Refresh - reload libraries with Module::Refresh
29
30 =cut
31