X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=p5sagit%2FDevel-REPL.git;a=blobdiff_plain;f=lib%2FDevel%2FREPL%2FPlugin%2FMultiLine%2FPPI.pm;fp=lib%2FDevel%2FREPL%2FPlugin%2FMultiLine%2FPPI.pm;h=d0040a501d6ba6db571fc3ac2b22bec0c9db7a8e;hp=f3ba89782a4ab02057f318c25aadb2d071cb87ca;hb=b21e755170420636ffad424d0634bc68e38956df;hpb=fa626608ee63e378ad7f476b24f732b7aa6c9745 diff --git a/lib/Devel/REPL/Plugin/MultiLine/PPI.pm b/lib/Devel/REPL/Plugin/MultiLine/PPI.pm index f3ba897..d0040a5 100644 --- a/lib/Devel/REPL/Plugin/MultiLine/PPI.pm +++ b/lib/Devel/REPL/Plugin/MultiLine/PPI.pm @@ -9,6 +9,11 @@ has 'continuation_prompt' => ( default => sub { '> ' } ); +has 'line_depth' => ( + is => 'rw', required => 1, lazy => 1, + default => sub { 0 } +); + around 'read' => sub { my $orig = shift; my ($self, @args) = @_; @@ -19,7 +24,10 @@ around 'read' => sub { my $orig_prompt = $self->prompt; $self->prompt($self->continuation_prompt); + $self->line_depth($self->line_depth + 1); my $append = $self->read(@args); + $self->line_depth($self->line_depth - 1); + $line .= $append if defined($append); $self->prompt($orig_prompt);