If the only thing you do with the IO::Socket::INET and read and write from it, you won't have any problem since the object is not used at all for that (just the file handle on which its built).
use strict;
use warnings;
use threads;
use IO::Socket::INET qw( );
use constant SHUT_WR => 1;
my $sock = IO::Socket::INET->new(
Proto => 'tcp',
PeerAddr => $ARGV[0] // 'localhost:echo',
)
or die $!;
async {
print while <$sock>;
};
async {
print($sock "abc\n");
sleep(3);
print($sock "def\n");
shutdown($sock, SHUT_WR);
};
$_->join for threads->list;
I don't know for IO::Socket::SSL.
Update: Added default argument.