package Device; use Command; use Comm; sub new { my $class = shift; my $self = { _device => shift, _serveraddr => shift, _port => shift }; bless $self, $class; return $self; } my $SockObj = Comm->new( $self->_serveraddr, $self->_port ); my $ComObj = Comm->new(); sub Action1 { my ( $self, $x, $y ) = @_; my $tmp = { 'hash1' => 'Command', 'value1' => $x, 'value2' => $y, 'Device' => $self->{_device} }; $InputRequest = $ComObj->CreateInputString($tmp); $SockObj->WriteInfo($InputRequest); my $Response = $SockObj->ReadData(); $ComObj->TapResponse($Response); }