if (my ($svc, @rest) = @{$expose->{$name}}) {
die "router has no service ${svc}"
unless my $service = $router->services->{$svc};
- $args{$name} = Tak::Client->new(service => $service)
- ->curry(@rest);
+ my $client_class = (
+ Scalar::Util::isweak($router->services->{$svc})
+ ? 'Tak::WeakClient'
+ : 'Tak::Client'
+ );
+ $args{$name} = $client_class->new(service => $service)
+ ->curry(@rest);
} else {
$args{$name} = Tak::WeakClient->new(service => $router);
}
use Moo;
-has sender => (is => 'ro', required => 1);
+has sender => (is => 'ro', required => 1, weak_ref => 1);
sub Tak::ModuleLoader::Hook::INC { # unqualified INC forced into package main
my ($self, $module) = @_;