X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=jsonrepl;h=415156785b39f73fa8163173c8c21f3e0145702b;hb=34a159d9d9bd8000f8bf9f56b19141c817dfbb89;hp=321beb01ff8eec7a0d9c8777f0cf1bfdd2ecc5e4;hpb=03ae33ef5f8178194331545ad512994f3c8356b4;p=scpubgit%2FTak.git diff --git a/jsonrepl b/jsonrepl index 321beb0..4151567 100644 --- a/jsonrepl +++ b/jsonrepl @@ -6,11 +6,14 @@ use Eval::WithLexicals; 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: $!"; } @@ -46,7 +49,10 @@ sub run_eval { out($code => { stdout => $output, stderr => $errors, return => $dumped_ret }); } +warn "starting\n" if $DEBUG; + while (my $line = ) { + warn "got: $line" if $DEBUG; my $data = eval { decode_json($line) }; if ($@) { out(MISTAKE => invalid_json => $@);