package Client; use IO::Socket; sub new { my $class = shift; my %args = @_; my $self = { parentWnd => $args{parentWnd} }; bless $self, $class; return $self; } sub initClient { my $self = shift; my $client = IO::Socket::INET::->new( Proto => 'tcp', PeerAddr => 'localhost', PeerPort => 55555 ) or die "Client can't connect: $!"; my @msgs = 1 .. 10; for (@msgs) { print $client "$_\n"; sleep 1; } } 1;