[Bast-commits] r4345 - trunk/Devel-REPL/lib/Devel/REPL/Plugin
Sartak at dev.catalyst.perl.org
Sartak at dev.catalyst.perl.org
Tue May 6 09:39:32 BST 2008
Author: Sartak
Date: 2008-05-06 09:39:31 +0100 (Tue, 06 May 2008)
New Revision: 4345
Modified:
trunk/Devel-REPL/lib/Devel/REPL/Plugin/Nopaste.pm
Log:
Refactor to make it easier to add print/warn to the session
Modified: trunk/Devel-REPL/lib/Devel/REPL/Plugin/Nopaste.pm
===================================================================
--- trunk/Devel-REPL/lib/Devel/REPL/Plugin/Nopaste.pm 2008-05-06 08:15:11 UTC (rev 4344)
+++ trunk/Devel-REPL/lib/Devel/REPL/Plugin/Nopaste.pm 2008-05-06 08:39:31 UTC (rev 4345)
@@ -16,6 +16,16 @@
},
);
+before eval => sub {
+ my $self = shift;
+ my $line = shift;
+
+ # prepend each line with #
+ $line =~ s/^/# /mg;
+
+ $self->add_to_session($line . "\n");
+};
+
around eval => sub {
my $orig = shift;
my $self = shift;
@@ -23,15 +33,8 @@
my @ret = $orig->($self, $line, @_);
- # prepend each line with #
- $line =~ s/^/# /mg;
+ $self->add_to_session(join("\n", @ret) . "\n\n");
- my $step = $line . "\n"
- . join("\n", @ret)
- . "\n\n";
-
- $self->add_to_session($step);
-
return @ret;
};
More information about the Bast-commits
mailing list