From 08ec0d4c0a2ef14d0e7ca78dd5a0b54dcade1132 Mon Sep 17 00:00:00 2001 From: Jesse Luehrs Date: Wed, 29 May 2013 05:07:33 -0500 Subject: clean up line reading a bit --- lib/App/REPL.pm | 4 ++-- lib/App/REPL/Plugin/Defaults.pm | 8 +++----- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/lib/App/REPL.pm b/lib/App/REPL.pm index 484cb84..bc7b8a6 100644 --- a/lib/App/REPL.pm +++ b/lib/App/REPL.pm @@ -87,8 +87,8 @@ sub run { sub _read { my $self = shift; - $self->_wrapped_plugin('display_prompt'); - my ($line) = $self->_wrapped_plugin('read_line'); + my $prompt = $self->_wrapped_plugin('prompt'); + my ($line) = $self->_wrapped_plugin('read_line', $prompt); return $line; } diff --git a/lib/App/REPL/Plugin/Defaults.pm b/lib/App/REPL/Plugin/Defaults.pm index 057fcce..23368e8 100644 --- a/lib/App/REPL/Plugin/Defaults.pm +++ b/lib/App/REPL/Plugin/Defaults.pm @@ -15,15 +15,13 @@ use base 'App::REPL::Plugin'; use Eval::Closure; -sub display_prompt { - my $self = shift; - - print "> "; -} +sub prompt { "> " } sub read_line { my $self = shift; + my ($next, $prompt) = @_; + print $prompt; return scalar <>; } -- cgit v1.2.3-54-g00ecf