diff --git a/lib/AnyEvent/REPL.pm b/lib/AnyEvent/REPL.pm index 78d7ac7..b0c2d1a 100644 --- a/lib/AnyEvent/REPL.pm +++ b/lib/AnyEvent/REPL.pm @@ -108,7 +108,7 @@ class AnyEvent::REPL { $backend->load_plugins(@{$args->{backend_plugins} || []}); my $frontend = AnyEvent::REPL::Frontend->new( - pty => $args->{comm}, + fh => $args->{comm}, ); my $loop = AnyEvent::REPL::Loop-> diff --git a/lib/AnyEvent/REPL/Frontend.pm b/lib/AnyEvent/REPL/Frontend.pm index 1241ab2..68fa4cc 100644 --- a/lib/AnyEvent/REPL/Frontend.pm +++ b/lib/AnyEvent/REPL/Frontend.pm @@ -3,14 +3,14 @@ use MooseX::Declare; class AnyEvent::REPL::Frontend with Devel::REPL::Frontend::API { use JSON; - has 'pty' => ( + has 'fh' => ( is => 'ro', isa => 'GlobRef', required => 1, ); method read { - my $fh = $self->pty; + my $fh = $self->fh; my $request_json = <$fh>; return if !$request_json; @@ -20,6 +20,7 @@ class AnyEvent::REPL::Frontend with Devel::REPL::Frontend::API { } method print(Ref $response) { - syswrite $self->pty, encode_json $response; + my $result = encode_json $response; + syswrite $self->fh, $result; } }