1 package Tak::ObjectService;
6 with 'Tak::Role::Service';
7 with 'Tak::Role::ObjectMangling';
9 has proxied => (is => 'ro', init_arg => undef, default => sub { {} });
12 my ($self, $tag) = @_;
13 $self->proxied->{$tag};
17 my ($self, $obj) = @_;
18 my $tag = overload::StrVal($obj);
19 $self->proxied->{$tag} = $obj;
20 return +{ __proxied_object__ => $tag };
23 sub handle_call_method {
24 my ($self, $context, $call) = @_;
25 my ($invocant, $method, @args) = @{$self->decode_objects($call)};
28 if (!ref($invocant)) {
29 (my $file = $invocant) =~ s/::/\//g;
33 @res = $invocant->$method(@args);
34 } elsif (defined $context) {
35 $res[0] = $invocant->$method(@args);
37 $invocant->$method(@args);
40 } or die [ failure => "$@" ];
41 return $self->encode_objects(\@res);
44 sub handle_remove_object {
45 my ($self, $tag) = @_;
46 my $had = !!delete $self->proxied->{$tag};