Tak/ObjectService.pm

filter: Statementstmt 20.6% 6 / 29 Branchbran 0.0% 0 / 8 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 33.3% 2 / 6 Podpod n/a totaltotal 18.6% 8 / 43 SCAR 29.8
CC
5
Cov
16%
handle_call_method
30.0
inflate
2.0
deflate
2.0
CRAP 19.7
« Tak/Loop.pm ↑ Summary Tak/ObjectClient.pm »
1 package Tak::ObjectService;
2  
3 1 ▶use overload ();
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use Moo;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 with 'Tak::Role::Service';
7 with 'Tak::Role::ObjectMangling';
8  
9 has proxied => (is => 'ro', init_arg => undef, default => sub { {} });
10  
11 sub inflate {
12 0 ▶ my ($self, $tag) = @_;
Subroutine inflate: not called CC=1 SCAR=6.9
13 0 $self->proxied->{$tag};
14 }
15  
16 sub deflate {
17 0 ▶ my ($self, $obj) = @_;
Subroutine deflate: not called CC=1 SCAR=6.9
18 0 my $tag = overload::StrVal($obj);
19 0 $self->proxied->{$tag} = $obj;
20 0 return +{ __proxied_object__ => $tag };
21 }
22  
23 sub handle_call_method {
24 0 ▶ my ($self, $context, $call) = @_;
Subroutine handle_call_method: not called CC=5 SCAR=34.0
25 0 my ($invocant, $method, @args) = @{$self->decode_objects($call)};
26 0 my @res;
27 0 ▶ eval {
Branch: 1 branch
BranchTrueFalseTotal
eval { do { unless (ref $invocant) { (my $file = $invocant) =~ s[::][/]g; require "$file.pm"; } ; if ($context) { @res = $invocant->$method(@args); } elsif (defined $context) { $res[0] = $invocant->$method(@args); } else { $invocant->$method(@args); } ; 1 } } or die ["failure", "$@"] 0 0 0
28 0 ▶ if (!ref($invocant)) {
Branch: 1 branch
BranchTrueFalseTotal
unless (ref $invocant) 0 0 0
29 0 (my $file = $invocant) =~ s/::/\//g;
30 0 require "${file}.pm";
31 }
32 0 ▶ if ($context) {
Branch: 2 branches
BranchTrueFalseTotal
if ($context) { } 0 0 0
elsif (defined $context) { } 0 0 0
33 0 @res = $invocant->$method(@args);
34 } elsif (defined $context) {
35 0 $res[0] = $invocant->$method(@args);
36 } else {
37 0 $invocant->$method(@args);
38 }
39 0 1;
40 } or die [ failure => "$@" ];
41 0 return $self->encode_objects(\@res);
42 }
43  
44 sub handle_remove_object {
45 0 ▶ my ($self, $tag) = @_;
Subroutine handle_remove_object: not called CC=1 SCAR=6.9
46 0 my $had = !!delete $self->proxied->{$tag};
47 0 return $had;
48 }
49  
50 1;
« Tak/Loop.pm ↑ Summary Tak/ObjectClient.pm »