use aliased 'App::Clifton::ConsoleService::Session';
use IO::Async::Listener;
use IO::Socket::UNIX;
-use Scalar::Util qw(weaken);
use Moo;
extends 'App::Clifton::Service';
has $_ => (is => 'lazy') for qw(listener session socket);
+has server => (is => 'ro', required => 1, weak_ref => 1);
+
sub _build_socket {
my ($self) = @_;
my $location = $self->socket_location;
my ($self) = @_;
Session->new->${\sub {
my ($session) = @_;
- $session->lex_env->lexicals->{'$_SERVICE'} = \$self;
- weaken(${$session->lex_env->{'$_SERVICE'}});
+ # no need to weaken this since server is already weak
+ $session->lex_env->lexicals->{'$_SERVER'} = \$self->server;
$session;
}};
}