From: Matt S Trout Date: Mon, 18 Jun 2012 01:16:40 +0000 (+0100) Subject: factor out new_class_call_handler X-Git-Tag: v0.001001~13 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=c5736e1ce44d413c01e9497aa49d4174f9bb37bf;p=scpubgit%2FObject-Remote.git factor out new_class_call_handler --- diff --git a/lib/Object/Remote/Connection.pm b/lib/Object/Remote/Connection.pm index 94bea15..8f4d443 100644 --- a/lib/Object/Remote/Connection.pm +++ b/lib/Object/Remote/Connection.pm @@ -129,17 +129,21 @@ sub send_class_call { sub register_class_call_handler { my ($self) = @_; $self->local_objects_by_id->{'class_call_handler'} ||= do { - my $o = Object::Remote::CodeContainer->new( - code => sub { - my ($class, $method) = (shift, shift); - use_module($class)->$method(@_); - } - ); + my $o = $self->new_class_call_handler; $self->_local_object_to_id($o); $o; }; } +sub new_class_call_handler { + Object::Remote::CodeContainer->new( + code => sub { + my ($class, $method) = (shift, shift); + use_module($class)->$method(@_); + } + ); +} + sub register_remote { my ($self, $remote) = @_; weaken($self->remote_objects_by_id->{$remote->id} = $remote);