X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=scpubgit%2FObject-Remote.git;a=blobdiff_plain;f=lib%2FObject%2FRemote%2FProxy.pm;h=68706bddff69d8f9bdb22f59cda96522cfbe8505;hp=b2ae3c69f4a9480233bb797c1d3efae7492fd159;hb=8c3529062a426181861d58ee59fb8f10e0be68e5;hpb=9e72f0cf54e92bccdba71eb75037f1cfe4f69f36 diff --git a/lib/Object/Remote/Proxy.pm b/lib/Object/Remote/Proxy.pm index b2ae3c6..68706bd 100644 --- a/lib/Object/Remote/Proxy.pm +++ b/lib/Object/Remote/Proxy.pm @@ -1,11 +1,21 @@ package Object::Remote::Proxy; use strictures 1; +use Carp qw(croak); sub AUTOLOAD { my $self = shift; (my $method) = (our $AUTOLOAD =~ /([^:]+)$/); - $self->{handle}->call($method => @_); + my $to_fire = $self->{method}; + 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 => @_); } sub DESTROY { }