build fatpacked world on the fly
Matt S Trout [Sun, 30 Oct 2011 04:32:38 +0000 (04:32 +0000)]
lib/Tak/REPL.pm
lib/Tak/WorldHandle.pm
maint/mk-fat [new file with mode: 0755]
takc [deleted file]
takd [deleted file]

index 977c5b6..4c4f161 100644 (file)
@@ -40,3 +40,5 @@ sub run {
     }
   }
 }
+
+1;
index 87877ab..8a2a187 100644 (file)
@@ -36,7 +36,7 @@ sub _build_router {
 
   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
diff --git a/maint/mk-fat b/maint/mk-fat
new file mode 100755 (executable)
index 0000000..45db08f
--- /dev/null
@@ -0,0 +1,7 @@
+#!/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;"
diff --git a/takc b/takc
deleted file mode 100644 (file)
index d9db431..0000000
--- a/takc
+++ /dev/null
@@ -1,52 +0,0 @@
-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";
-  }
-}
diff --git a/takd b/takd
deleted file mode 100644 (file)
index 0f806ec..0000000
--- a/takd
+++ /dev/null
@@ -1,4 +0,0 @@
-use lib 'lib';
-use Tak::World;
-
-Tak::World->new_from_stdio->run;