line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Zonemaster::GUI::Dancer::Client; |
2
|
|
|
|
|
|
|
our $VERSION = '1.0.7'; |
3
|
|
|
|
|
|
|
|
4
|
2
|
|
|
2
|
|
11
|
use strict; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
60
|
|
5
|
2
|
|
|
2
|
|
9
|
use warnings; |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
37
|
|
6
|
2
|
|
|
2
|
|
940
|
use utf8; |
|
2
|
|
|
|
|
23
|
|
|
2
|
|
|
|
|
9
|
|
7
|
2
|
|
|
2
|
|
55
|
use 5.10.1; |
|
2
|
|
|
|
|
6
|
|
8
|
|
|
|
|
|
|
|
9
|
2
|
|
|
2
|
|
980
|
use LWP::UserAgent; |
|
2
|
|
|
|
|
30071
|
|
|
2
|
|
|
|
|
51
|
|
10
|
2
|
|
|
2
|
|
979
|
use JSON; |
|
2
|
|
|
|
|
13571
|
|
|
2
|
|
|
|
|
8
|
|
11
|
2
|
|
|
2
|
|
183
|
use Time::HiRes qw(gettimeofday); |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
13
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
our $AUTOLOAD; |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
sub new { |
16
|
2
|
|
|
2
|
0
|
6
|
my ( $type, $params ) = @_; |
17
|
|
|
|
|
|
|
|
18
|
2
|
|
|
|
|
6
|
my $self = $params; |
19
|
2
|
|
|
|
|
4
|
bless( $self, $type ); |
20
|
|
|
|
|
|
|
|
21
|
2
|
|
|
|
|
20
|
$self->{lwp} = LWP::UserAgent->new; |
22
|
|
|
|
|
|
|
|
23
|
2
|
|
|
|
|
4127
|
return ( $self ); |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
sub AUTOLOAD { |
27
|
0
|
|
|
0
|
|
|
my $self = shift; |
28
|
|
|
|
|
|
|
|
29
|
0
|
|
|
|
|
|
my $program = $AUTOLOAD; |
30
|
0
|
|
|
|
|
|
$program =~ s/.*:://; |
31
|
|
|
|
|
|
|
|
32
|
0
|
|
|
|
|
|
my ( $s, $usec ) = gettimeofday(); |
33
|
0
|
|
|
|
|
|
my $id = $s * 100000 + $usec; |
34
|
|
|
|
|
|
|
|
35
|
0
|
|
|
|
|
|
my ( $method ) = ( $AUTOLOAD =~ /::([^:]+)$/ ); |
36
|
0
|
|
|
|
|
|
my $json = encode_json( { "jsonrpc" => "2.0", "method" => $method, "params" => @_, "id" => $id } ); |
37
|
|
|
|
|
|
|
|
38
|
0
|
|
|
|
|
|
my $req = HTTP::Request->new( 'POST', $self->{url} ); |
39
|
0
|
|
|
|
|
|
$req->header( 'Content-Type' => 'application/json' ); |
40
|
0
|
|
|
|
|
|
$req->content( $json ); |
41
|
|
|
|
|
|
|
|
42
|
0
|
|
|
|
|
|
my $response = $self->{lwp}->request( $req ); |
43
|
|
|
|
|
|
|
|
44
|
0
|
0
|
|
|
|
|
die "Package:" . __PACKAGE__ . " / Line:" . __LINE__ . " / LWP Error: ", $response->status_line |
45
|
|
|
|
|
|
|
unless $response->is_success; |
46
|
|
|
|
|
|
|
|
47
|
0
|
|
|
|
|
|
my $json_rpc_response = decode_json( $response->content() ); |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
die "Package:" |
50
|
|
|
|
|
|
|
. __PACKAGE__ |
51
|
|
|
|
|
|
|
. " / Line:" |
52
|
|
|
|
|
|
|
. __LINE__ |
53
|
|
|
|
|
|
|
. " / JSON::RPC Eror: " |
54
|
|
|
|
|
|
|
. $json_rpc_response->{error}->{message} |
55
|
0
|
0
|
|
|
|
|
if $json_rpc_response->{error}; |
56
|
|
|
|
|
|
|
|
57
|
0
|
|
|
|
|
|
return ( $json_rpc_response->{result} ); |
58
|
|
|
|
|
|
|
} |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
0
|
|
|
sub DESTROY { |
61
|
|
|
|
|
|
|
} |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
1; |