summaryrefslogtreecommitdiffstats
path: root/lib/Reply.pm
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Reply.pm')
-rw-r--r--lib/Reply.pm17
1 files changed, 12 insertions, 5 deletions
diff --git a/lib/Reply.pm b/lib/Reply.pm
index e4c663e..ad72fff 100644
--- a/lib/Reply.pm
+++ b/lib/Reply.pm
@@ -116,20 +116,27 @@ sub run {
print "\n";
}
-=method step($line)
+=method step($line, $verbose)
Runs a single iteration of the repl. If C<$line> is given, it will be used as
the string to evaluate (and the C<prompt> and C<read_line> callbacks will not
-be called). Returns true if the repl can continue, and false if it was
-requested to quit.
+be called). If C<$verbose> is true, the prompt and line will be displayed as
+though they were typed. Returns true if the repl can continue, and false if it
+was requested to quit.
=cut
sub step {
my $self = shift;
- my ($line) = @_;
+ my ($line, $verbose) = @_;
- $line = $self->_read unless defined $line;
+ if (defined $line) {
+ print $self->_wrapped_plugin('prompt'), $line, "\n"
+ if $verbose;
+ }
+ else {
+ $line = $self->_read;
+ }
return unless defined $line;