my ($stdin, $stdout) = $self->connection->open2('perl -');
- $stdin->print(io('takd')->all, "__END__\n");
+ $stdin->print(io('maint/mk-fat |')->all, "__END__\n");
my $channel = Tak::JSONChannel->new(
read_fh => $stdout, write_fh => $stdin
--- /dev/null
+#!/bin/sh
+
+if [ -e fatlib ]; then rm -r fatlib; fi
+fatpack tree $(fatpack packlists-for strictures.pm Moo.pm JSON/PP.pm)
+fatpack file
+rm -r fatlib
+echo "use Tak::World; Tak::World->new_from_stdio->run;"
+++ /dev/null
-use strictures 1;
-use Tak::JSONChannel;
-use Tak::Router;
-use IPC::Open2;
-use Tak::Remote;
-use Tak::ModuleSender;
-use Tak::ServiceManager;
-use Term::ReadLine;
-
-my $pid = open2(my $out, my $in, $^X, qw(-Ilib takd))
- or die "Couldn't open2 child: $!";
-
-my $channel = Tak::JSONChannel->new(
- read_fh => $out,
- write_fh => $in
-);
-
-my $router = Tak::Router->new(
- channel => $channel,
- local_request_handlers => {
- MODULE_SENDER => Tak::ServiceManager->new(
- service => Tak::ModuleSender->new
- )
- },
-);
-
-my $remote = Tak::Remote->new(
- router => $router,
- name => 'EVAL'
-);
-
-my $read = Term::ReadLine->new('REPL');
-
-while (1) {
- my $line = $read->readline('re.pl$ ');
- exit unless defined $line;
- next unless length $line;
- my $reply = [ $remote->blocking_request(eval => $line) ];
- if ($reply->[0] eq 'MISTAKE') {
- die "Botch: ".join(': ', @{$reply}[1,2]);
- }
- my $ret = $reply->[1];
- print $ret->{return};
- if ($ret->{stdout}) {
- chomp($ret->{stdout});
- print "STDOUT:\n${\$ret->{stdout}}\n";
- }
- if ($ret->{stderr}) {
- chomp($ret->{stderr});
- print "STDERR:\n${\$ret->{stderr}}\n";
- }
-}