summaryrefslogtreecommitdiffstats
path: root/lib/App/REPL/Plugin/ReadLine.pm
blob: f2fe84764f0e75a408d8a579dafd3c0047aa0f4e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
package App::REPL::Plugin::ReadLine;
use strict;
use warnings;

use base 'App::REPL::Plugin';

use Term::ReadLine;

sub new {
    my $class = shift;

    my $self = $class->SUPER::new(@_);
    $self->{term} = Term::ReadLine->new('App::REPL');

    return $self;
}

sub read_line {
    my $self = shift;
    my ($next, $prompt) = @_;

    return $self->{term}->readline($prompt);
}

1;