[Bast-commits] r3708 - in trunk/Devel-REPL/lib/Devel/REPL: Plugin Profile

sukria at dev.catalyst.perl.org sukria at dev.catalyst.perl.org
Fri Aug 24 13:45:35 GMT 2007


Author: sukria
Date: 2007-08-24 13:45:34 +0100 (Fri, 24 Aug 2007)
New Revision: 3708

Added:
   trunk/Devel-REPL/lib/Devel/REPL/Plugin/Refresh.pm
Modified:
   trunk/Devel-REPL/lib/Devel/REPL/Profile/Default.pm
Log:
new plugin for refreshing loaded modules that changes during the session


Added: trunk/Devel-REPL/lib/Devel/REPL/Plugin/Refresh.pm
===================================================================
--- trunk/Devel-REPL/lib/Devel/REPL/Plugin/Refresh.pm	                        (rev 0)
+++ trunk/Devel-REPL/lib/Devel/REPL/Plugin/Refresh.pm	2007-08-24 12:45:34 UTC (rev 3708)
@@ -0,0 +1,20 @@
+package Devel::REPL::Plugin::Refresh;
+
+use Moose::Role;
+use namespace::clean -except => [ 'meta' ];
+use Module::Refresh;
+
+# before evaluating the code, ask Module::Refresh to refresh
+# the modules that have changed
+around 'eval' => sub {
+    my $orig = shift;
+    my ($self, $line) = @_;
+
+    # first refresh the changed modules
+    Module::Refresh->refresh;
+
+    # the eval the code
+    return $self->$orig($line);
+};
+
+1;

Modified: trunk/Devel-REPL/lib/Devel/REPL/Profile/Default.pm
===================================================================
--- trunk/Devel-REPL/lib/Devel/REPL/Profile/Default.pm	2007-08-22 15:33:28 UTC (rev 3707)
+++ trunk/Devel-REPL/lib/Devel/REPL/Profile/Default.pm	2007-08-24 12:45:34 UTC (rev 3708)
@@ -6,7 +6,7 @@
 with 'Devel::REPL::Profile';
 
 sub plugins {
-  qw(History LexEnv DDS Packages Commands);
+  qw(History LexEnv DDS Packages Commands Refresh);
 }
 
 sub apply_profile {




More information about the Bast-commits mailing list