line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Patro::N6; |
2
|
2
|
|
|
2
|
|
15
|
use strict; |
|
2
|
|
|
|
|
6
|
|
|
2
|
|
|
|
|
108
|
|
3
|
2
|
|
|
2
|
|
15
|
use warnings; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
140
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
# Patro::N6. Proxy class for REF type references |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
# we must keep this namespace very clean |
8
|
2
|
|
|
2
|
|
14
|
use Carp (); |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
364
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
use overload |
11
|
|
|
|
|
|
|
'${}' => \&Patro::N6x::deref, |
12
|
|
|
|
|
|
|
'nomethod' => \&Patro::LeumJelly::overload_handler, |
13
|
2
|
|
|
2
|
|
656
|
'@{}' => sub { Patro::LeumJelly::deref_handler(@_,'@{}') }, |
14
|
1
|
|
|
1
|
|
6
|
'%{}' => sub { Patro::LeumJelly::deref_handler(@_,'%{}') }, |
15
|
0
|
|
|
0
|
|
0
|
'&{}' => sub { Patro::LeumJelly::deref_handler(@_,'&{}') }, |
16
|
2
|
|
|
2
|
|
17
|
; |
|
2
|
|
|
|
|
24
|
|
|
2
|
|
|
|
|
93
|
|
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
# override UNIVERSAL methods |
19
|
|
|
|
|
|
|
foreach my $umethod (keys %UNIVERSAL::) { |
20
|
2
|
|
|
2
|
|
177
|
no strict 'refs'; |
|
2
|
|
|
|
|
11
|
|
|
2
|
|
|
|
|
1032
|
|
21
|
|
|
|
|
|
|
*{$umethod} = sub { |
22
|
2
|
|
|
2
|
|
7
|
my $proxy = shift; |
23
|
2
|
100
|
|
|
|
9
|
if (!CORE::ref($proxy)) { |
24
|
1
|
|
|
|
|
5
|
$umethod = "UNIVERSAL::" . $umethod; |
25
|
1
|
|
|
|
|
14
|
return $umethod->($proxy,@_); |
26
|
|
|
|
|
|
|
} |
27
|
1
|
50
|
|
|
|
5
|
my $context = defined(wantarray) ? 1 + wantarray : 0; |
28
|
1
|
|
|
|
|
4
|
my $id = Patro::_fetch($proxy,"id"); |
29
|
1
|
|
|
|
|
39
|
return Patro::LeumJelly::proxy_request( $proxy, |
30
|
|
|
|
|
|
|
{ id => $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
|
0
|
|
|
|
|
0
|
my $id = Patro::_fetch($self,"id"); |
45
|
|
|
|
|
|
|
|
46
|
0
|
|
|
|
|
0
|
return Patro::LeumJelly::proxy_request( $self, |
47
|
|
|
|
|
|
|
{ id => $id, |
48
|
|
|
|
|
|
|
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
|
5
|
|
|
5
|
|
28
|
my $proxy = shift; |
58
|
5
|
|
|
|
|
18
|
my $id = Patro::_fetch($proxy,"id"); |
59
|
5
|
|
|
|
|
40
|
my $resp = Patro::LeumJelly::proxy_request( |
60
|
|
|
|
|
|
|
$proxy, |
61
|
|
|
|
|
|
|
{ id => $id, |
62
|
|
|
|
|
|
|
topic => 'REF', |
63
|
|
|
|
|
|
|
command => 'deref', |
64
|
|
|
|
|
|
|
has_args => 0, args => [], |
65
|
|
|
|
|
|
|
context => 1 } ); |
66
|
5
|
|
|
|
|
68
|
return \$resp; |
67
|
|
|
|
|
|
|
} |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
sub DESTROY { |
70
|
0
|
|
|
0
|
|
|
my $self = shift; |
71
|
0
|
|
|
|
|
|
bless $self, '###'; |
72
|
0
|
|
|
|
|
|
my $z = $self->{_DESTROY}++; |
73
|
0
|
|
|
|
|
|
my $socket = $self->{socket}; |
74
|
0
|
|
|
|
|
|
my $id = $self->{id}; |
75
|
0
|
|
|
|
|
|
bless $self, __PACKAGE__; |
76
|
0
|
0
|
|
|
|
|
return if $z; |
77
|
|
|
|
|
|
|
|
78
|
0
|
0
|
|
|
|
|
if ($socket) { |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
# XXX - shouldn't disconnect on every object destruction, |
81
|
|
|
|
|
|
|
# only when all of the wrapped objects associated with a |
82
|
|
|
|
|
|
|
# client have been destroyed, or during global |
83
|
|
|
|
|
|
|
# destruction |
84
|
|
|
|
|
|
|
|
85
|
0
|
|
|
|
|
|
Patro::LeumJelly::proxy_request( $self, |
86
|
|
|
|
|
|
|
{ id => $id, |
87
|
|
|
|
|
|
|
topic => 'META', |
88
|
|
|
|
|
|
|
command => 'disconnect' } ); |
89
|
0
|
|
|
|
|
|
close $socket; |
90
|
|
|
|
|
|
|
} |
91
|
|
|
|
|
|
|
} |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
1; |
94
|
|
|
|
|
|
|
|