+ - Provide a $client in repl objects
- Support for -l/--local in Tak::Script
0.001001 - 2011-11-15
has 'eval_withlexicals' => (is => 'lazy');
+has 'service_client' => (is => 'ro', predicate => 'has_service_client');
+
sub _build_eval_withlexicals {
- Eval::WithLexicals->new
+ my ($self) = @_;
+ Eval::WithLexicals->new(
+ $self->has_service_client
+ ? (lexicals => { '$client' => \($self->service_client) })
+ : ()
+ );
}
sub handle_eval {
my ($self, $remote, $options) = @_;
require Tak::REPL;
require B;
- $remote->ensure(eval_service => 'Tak::EvalService');
+ $remote->ensure(
+ eval_service => 'Tak::EvalService',
+ expose => { service_client => [ '' ] },
+ );
foreach my $lib (@{$options->{'I'}||[]}) {
$remote->do(eval_service => eval => "lib->import(${\B::perlstring($lib)})");
}