use Data::Dumper::Concise;
use IO::Handle;
+our $DEBUG;
+
STDOUT->autoflush(1);
my $eval = Eval::WithLexicals->new;
sub out {
+ warn "sending: ".encode_json([ @_ ])."\n" if $DEBUG;
print STDOUT encode_json([ @_ ])."\n"
or die "Failed to print to STDOUT: $!";
}
out($code => { stdout => $output, stderr => $errors, return => $dumped_ret });
}
+warn "starting\n" if $DEBUG;
+
while (my $line = <STDIN>) {
+ warn "got: $line" if $DEBUG;
my $data = eval { decode_json($line) };
if ($@) {
out(MISTAKE => invalid_json => $@);