sub new { my ($class, $type, $id) = @_; die "You must construct a SharedObject with a type" unless $type; my $self = { TYPE => $type, ID => $id, MODIFIED => 0, RECORD => {} }; bless $self, $class; # retrieve data from the shared objects cache: if ($id) { my ($sock, $req, $res); $sock = IO::Socket::INET->new ( PeerAddr => $appdata{SOBJIP}, # 127.0.0.1 PeerPort => $appdata{SOBJPORT}, # 8000 Proto => 'tcp', Type => SOCK_STREAM, Reuse => 1) || die $!; $req = SOD::Session::Client::Request->new($appdata{SOBJCOMMAND}, $appdata{SOBJCONTENT}); # SOBJCOMMAND == 6, SOBJCONTENT == 8 $res = SOD::Session::Client::Response->new($appdata{SOBJCOMMAND}, $appdata{SOBJCONTENT}); unless ($req->send($sock, 'get ', { 'type' => $type, 'id' => $id })) { die SOD::Session::Error::get($req->error->get)."\t".$req->error->msg; $sock->close || die $!; } unless ($res->receive($sock)) { die SOD::Session::Error::get($res->error->get)."\t".$res->error->msg; } $sock->close || die $!; undef $sock; $self->{RECORD} = $res->content; } $self; }