diff options
author | Jesse Luehrs <doy@tozt.net> | 2014-07-04 18:27:06 -0400 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2014-07-04 18:27:06 -0400 |
commit | d280566f9278c24228cf57090c14ee4d705348a1 (patch) | |
tree | 2594866c2eae7e8a96d573bdeb0e07b8c573ee2a /lib/Reply.pm | |
parent | 9a09a819c4a05a1ebe7dcfa0cfa6d1f63df9b7be (diff) | |
download | reply-d280566f9278c24228cf57090c14ee4d705348a1.tar.gz reply-d280566f9278c24228cf57090c14ee4d705348a1.zip |
simplify
Diffstat (limited to 'lib/Reply.pm')
-rw-r--r-- | lib/Reply.pm | 17 |
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; |