X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FObject%2FRemote%2FProxy.pm;h=68706bddff69d8f9bdb22f59cda96522cfbe8505;hb=b3e30047cb366c1a78e2ec716f7e89136430384f;hp=af6a902350f9421833defab820c607f8cf07e1c1;hpb=dc28afe80b27f0eb81eef66e6ba554a7c1fb6e41;p=scpubgit%2FObject-Remote.git diff --git a/lib/Object/Remote/Proxy.pm b/lib/Object/Remote/Proxy.pm index af6a902..68706bd 100644 --- a/lib/Object/Remote/Proxy.pm +++ b/lib/Object/Remote/Proxy.pm @@ -1,14 +1,21 @@ package Object::Remote::Proxy; use strictures 1; +use Carp qw(croak); sub AUTOLOAD { my $self = shift; (my $method) = (our $AUTOLOAD =~ /([^:]+)$/); + my $to_fire = $self->{method}; if ((caller(0)||'') eq 'start') { - $method = "start::${method}"; + $to_fire = "start::${to_fire}"; } - $self->{remote}->${\$self->{method}}($method => @_); + + unless ($self->{remote}->is_valid) { + croak "Attempt to use Object::Remote::Proxy backed by an invalid handle"; + } + + $self->{remote}->$to_fire($method => @_); } sub DESTROY { }