line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Patro::N6; |
2
|
3
|
|
|
3
|
|
17
|
use strict; |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
90
|
|
3
|
3
|
|
|
3
|
|
21
|
use warnings; |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
121
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
# Patro::N6. Proxy class for REF type references |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
# we must keep this namespace very clean |
8
|
3
|
|
|
3
|
|
18
|
use Carp (); |
|
3
|
|
|
|
|
4
|
|
|
3
|
|
|
|
|
321
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
use overload |
11
|
|
|
|
|
|
|
'${}' => \&Patro::N6x::deref, |
12
|
|
|
|
|
|
|
'nomethod' => \&Patro::LeumJelly::overload_handler, |
13
|
5
|
|
|
5
|
|
606
|
'@{}' => sub { Patro::LeumJelly::deref_handler(@_,'@{}') }, |
14
|
2
|
|
|
2
|
|
8
|
'%{}' => sub { Patro::LeumJelly::deref_handler(@_,'%{}') }, |
15
|
0
|
|
|
0
|
|
0
|
'&{}' => sub { Patro::LeumJelly::deref_handler(@_,'&{}') }, |
16
|
3
|
|
|
3
|
|
17
|
; |
|
3
|
|
|
|
|
5
|
|
|
3
|
|
|
|
|
134
|
|
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
# override UNIVERSAL methods |
19
|
|
|
|
|
|
|
foreach my $umethod (keys %UNIVERSAL::) { |
20
|
3
|
|
|
3
|
|
147
|
no strict 'refs'; |
|
3
|
|
|
|
|
4
|
|
|
3
|
|
|
|
|
224
|
|
21
|
|
|
|
|
|
|
*{$umethod} = sub { |
22
|
2
|
|
|
2
|
|
4
|
my $proxy = shift; |
23
|
2
|
100
|
|
|
|
5
|
if (!CORE::ref($proxy)) { |
24
|
1
|
|
|
|
|
2
|
$umethod = "UNIVERSAL::" . $umethod; |
25
|
1
|
|
|
|
|
7
|
return $umethod->($proxy,@_); |
26
|
|
|
|
|
|
|
} |
27
|
1
|
50
|
|
|
|
4
|
my $context = defined(wantarray) ? 1 + wantarray : 0; |
28
|
3
|
|
|
3
|
|
13
|
no overloading; |
|
3
|
|
|
|
|
7
|
|
|
3
|
|
|
|
|
446
|
|
29
|
|
|
|
|
|
|
return Patro::LeumJelly::proxy_request( $proxy, |
30
|
1
|
|
|
|
|
27
|
{ id => $proxy->{id}, topic => 'METHOD', command => $umethod, |
31
|
|
|
|
|
|
|
has_args => @_ > 0, args => [ @_ ], context => $context }, @_ ); |
32
|
|
|
|
|
|
|
}; |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
sub AUTOLOAD { |
36
|
0
|
|
|
0
|
|
0
|
my $method = $Patro::N6::AUTOLOAD; |
37
|
0
|
|
|
|
|
0
|
$method =~ s/.*:://; |
38
|
|
|
|
|
|
|
|
39
|
0
|
|
|
|
|
0
|
my $self = shift; |
40
|
0
|
|
|
|
|
0
|
my $has_args = @_ > 0; |
41
|
0
|
|
|
|
|
0
|
my $args = [ @_ ]; |
42
|
|
|
|
|
|
|
|
43
|
0
|
0
|
|
|
|
0
|
my $context = defined(wantarray) ? 1 + wantarray : 0; |
44
|
3
|
|
|
3
|
|
17
|
no overloading; |
|
3
|
|
|
|
|
4
|
|
|
3
|
|
|
|
|
201
|
|
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
return Patro::LeumJelly::proxy_request( $self, |
47
|
|
|
|
|
|
|
{ id => $self->{id}, |
48
|
0
|
|
|
|
|
0
|
topic => 'METHOD', |
49
|
|
|
|
|
|
|
command => $method, |
50
|
|
|
|
|
|
|
has_args => $has_args, |
51
|
|
|
|
|
|
|
args => $args, |
52
|
|
|
|
|
|
|
context => $context, |
53
|
|
|
|
|
|
|
_autoload => 1 }, @_ ); |
54
|
|
|
|
|
|
|
} |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
sub Patro::N6x::deref { |
57
|
6
|
|
|
6
|
|
706
|
my $proxy = shift; |
58
|
3
|
|
|
3
|
|
16
|
no overloading; |
|
3
|
|
|
|
|
5
|
|
|
3
|
|
|
|
|
199
|
|
59
|
|
|
|
|
|
|
my $resp = Patro::LeumJelly::proxy_request( |
60
|
|
|
|
|
|
|
$proxy, |
61
|
|
|
|
|
|
|
{ id => $proxy->{id}, |
62
|
6
|
|
|
|
|
37
|
topic => 'REF', |
63
|
|
|
|
|
|
|
command => 'deref', |
64
|
|
|
|
|
|
|
has_args => 0, args => [], |
65
|
|
|
|
|
|
|
context => 1 } ); |
66
|
6
|
|
|
|
|
50
|
return \$resp; |
67
|
|
|
|
|
|
|
} |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
sub DESTROY { |
70
|
0
|
|
|
0
|
|
|
my $self = shift; |
71
|
3
|
|
|
3
|
|
13
|
no overloading; |
|
3
|
|
|
|
|
7
|
|
|
3
|
|
|
|
|
261
|
|
72
|
0
|
0
|
|
|
|
|
return if $self->{_DESTROY}++; |
73
|
0
|
|
|
|
|
|
my $socket = $self->{socket}; |
74
|
0
|
|
|
|
|
|
my $id = $self->{id}; |
75
|
|
|
|
|
|
|
|
76
|
0
|
0
|
|
|
|
|
if ($socket) { |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
# XXX - shouldn't disconnect on every object destruction, |
79
|
|
|
|
|
|
|
# only when all of the wrapped objects associated with a |
80
|
|
|
|
|
|
|
# client have been destroyed, or during global |
81
|
|
|
|
|
|
|
# destruction |
82
|
|
|
|
|
|
|
|
83
|
0
|
|
|
|
|
|
Patro::LeumJelly::proxy_request( $self, |
84
|
|
|
|
|
|
|
{ id => $id, |
85
|
|
|
|
|
|
|
topic => 'META', |
86
|
|
|
|
|
|
|
command => 'disconnect' } ); |
87
|
0
|
|
|
|
|
|
close $socket; |
88
|
|
|
|
|
|
|
} |
89
|
|
|
|
|
|
|
} |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
1; |
92
|
|
|
|
|
|
|
|