my $cmd = do {
if (my $host = $ARGV[0]) {
- 'cat jsonrepl.packed - | ssh '.$host.' perl -'
+ 'ssh '.$host.' perl -'
} else {
- 'perl jsonrepl'
+ 'perl -'
}
};
my $pid = open2(my $out, my $in, $cmd);
+{
+ my $jr;
+ if (!eof(*DATA)) {
+ $jr = \*DATA
+ } else {
+ open $jr, '<', 'jsonrepl.packed' or die "No packed repl: $!";
+ }
+ while (<$jr>) { print $in $_ }
+ print $in "__END__\n";
+}
+
my $read = Term::ReadLine->new('REPL');
while (1) {