5.8 also requires extra C3 bits
[scpubgit/Object-Remote.git] / lib / Object / Remote / Handle.pm
index 1a757ab..4fac320 100644 (file)
@@ -27,13 +27,15 @@ sub proxy {
 
 sub BUILD {
   my ($self, $args) = @_;
-  unless ($self->id) {
+  if ($self->id) {
+    $self->disarm_free;
+  } else {
     die "No id supplied and no class either" unless $args->{class};
     ref($_) eq 'HASH' and $_ = [ %$_ ] for $args->{args};
     $self->_set_id(
       await_future(
-        $self->connection->send(
-          class_call => $args->{class}, 0,
+        $self->connection->send_class_call(
+          0, $args->{class},
           $args->{constructor}||'new', @{$args->{args}||[]}
         )
       )->{remote}->disarm_free->id