From: Matt S Trout Date: Sun, 30 Oct 2011 04:32:38 +0000 (+0000) Subject: build fatpacked world on the fly X-Git-Tag: v0.001001~31 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=6fd3956225d96b0d2ce19655ebd671917cdd0d0e;p=scpubgit%2FTak.git build fatpacked world on the fly --- diff --git a/lib/Tak/REPL.pm b/lib/Tak/REPL.pm index 977c5b6..4c4f161 100644 --- a/lib/Tak/REPL.pm +++ b/lib/Tak/REPL.pm @@ -40,3 +40,5 @@ sub run { } } } + +1; diff --git a/lib/Tak/WorldHandle.pm b/lib/Tak/WorldHandle.pm index 87877ab..8a2a187 100644 --- a/lib/Tak/WorldHandle.pm +++ b/lib/Tak/WorldHandle.pm @@ -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 index 0000000..45db08f --- /dev/null +++ b/maint/mk-fat @@ -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 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 index 0f806ec..0000000 --- a/takd +++ /dev/null @@ -1,4 +0,0 @@ -use lib 'lib'; -use Tak::World; - -Tak::World->new_from_stdio->run;