use 5.020; use strict; use warnings; use IO::Socket; my $buffer = ""; my $db_prompt_regex = qr/DB<\d+> $/; my $db_interface = IO::Socket::INET->new( Listen => 1, Proto => 'tcp', ReusePort => 1, LocalPort => 5555) or die "Socket-Problem: $@"; $db_interface->autoflush; say "Beginne die Session mit: PERLDB_OPTS=RemotePort=localhost:5555 perl -d "; my $client = $db_interface->accept(); COMMAND_LOOP: while (1) { do { $client->recv($buffer,1024); print $buffer; } while ($buffer !~ /$db_prompt_regex/); my $command = ; $client->print($command); if ($command =~ /\s*q\s*\n/) { last COMMAND_LOOP; } }