r61340@onn: sartak | 2008-05-31 12:17:19 -0400
[p5sagit/Devel-REPL.git] / lib / Devel / REPL / Plugin / Refresh.pm
1 package Devel::REPL::Plugin::Refresh;
2
3 use Moose::Role;
4 use namespace::clean -except => [ 'meta' ];
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;
21
22 __END__
23
24 =head1 NAME
25
26 Devel::REPL::Plugin::Refresh - reload libraries with Module::Refresh
27
28 =cut
29