}
}
-sub each_repl {
- my ($self, $remote) = @_;
+sub each_repl (I=s@;m=s@;M=s@) {
+ my ($self, $remote, $options) = @_;
require Tak::REPL;
+ require B;
$remote->ensure(eval_service => 'Tak::EvalService');
+ foreach my $lib (@{$options->{'I'}||[]}) {
+ $remote->do(eval_service => eval => "lib->import(${\B::perlstring($lib)})");
+ }
+ foreach my $module (@{$options->{'m'}||[]}) {
+ $remote->do(eval_service => eval => "use ${module} ()");
+ }
+ foreach my $spec (@{$options->{'M'}||[]}) {
+ my ($module, $import) = split('=', $spec);
+ my $extra = '';
+ if ($import) {
+ $extra = ' '.join(', ', map B::perlstring($_), split(',',$import));
+ }
+ $remote->do(eval_service => eval => "use ${module}${extra}");
+ }
Tak::REPL->new(client => $remote->curry('eval_service'))->run;
}