proxy dies() when a method is invoked and the handle is not valid; add 2 more exclusi...
[scpubgit/Object-Remote.git] / lib / Object / Remote / Proxy.pm
index 3c46eeb..68706bd 100644 (file)
@@ -1,6 +1,7 @@
 package Object::Remote::Proxy;
 
 use strictures 1;
+use Carp qw(croak);
 
 sub AUTOLOAD {
   my $self = shift;
@@ -9,6 +10,11 @@ sub AUTOLOAD {
   if ((caller(0)||'') eq 'start') {
     $to_fire = "start::${to_fire}";
   }
+  
+  unless ($self->{remote}->is_valid) {
+    croak "Attempt to use Object::Remote::Proxy backed by an invalid handle";
+  }
+  
   $self->{remote}->$to_fire($method => @_);
 }