line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# |
2
|
|
|
|
|
|
|
# (c) Jan Gehring |
3
|
|
|
|
|
|
|
# |
4
|
|
|
|
|
|
|
# vim: set ts=3 sw=3 tw=0: |
5
|
|
|
|
|
|
|
# vim: set expandtab: |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
=head1 NAME |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
Rex::IO::Client - Client Library for Rex::IO::Server |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
=head1 GETTING HELP |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
=over 4 |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
=item * IRC: irc.freenode.net #rex |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
=item * Bug Tracker: L |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
=back |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
=head1 SYNOPSIS |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
my $cl = Rex::IO::Client->create( |
24
|
|
|
|
|
|
|
protocol => 1, |
25
|
|
|
|
|
|
|
endpoint => "http://" |
26
|
|
|
|
|
|
|
. $user . ":" |
27
|
|
|
|
|
|
|
. $password . '@' |
28
|
|
|
|
|
|
|
. $server_url |
29
|
|
|
|
|
|
|
); |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
my $ret = $cl->call("GET", "1.0", "user", user => undef)->{data}; |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
my $ret = $cl->call( |
34
|
|
|
|
|
|
|
"POST", "1.0", "user", |
35
|
|
|
|
|
|
|
user => undef, |
36
|
|
|
|
|
|
|
ref => $self->req->json->{data}, |
37
|
|
|
|
|
|
|
); |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
my $ret = $cl->call( "DELETE", "1.0", "user", user => $self->param("user_id") ); |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
=head1 METHODS |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
=over 4 |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
=item get_plugins() |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
List all known server plugins. |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
=item call($verb, $version, $plugin, @param) |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
Creates a backend request. |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
=back |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
=cut |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
package Rex::IO::Client; |
58
|
|
|
|
|
|
|
|
59
|
1
|
|
|
1
|
|
741
|
use strict; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
27
|
|
60
|
1
|
|
|
1
|
|
4
|
use warnings; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
28
|
|
61
|
1
|
|
|
1
|
|
971
|
use Data::Dumper; |
|
1
|
|
|
|
|
6730
|
|
|
1
|
|
|
|
|
229
|
|
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
our $VERSION = '0.6'; # VERSION |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
sub create { |
66
|
|
|
|
|
|
|
|
67
|
1
|
|
|
1
|
0
|
411
|
my ( $class, %option ) = @_; |
68
|
|
|
|
|
|
|
|
69
|
1
|
|
50
|
|
|
8
|
my $version = $option{protocol} || 1; |
70
|
|
|
|
|
|
|
|
71
|
1
|
|
|
|
|
3
|
my $klass = "Rex::IO::Client::Protocol::V$version"; |
72
|
1
|
|
|
1
|
|
620
|
eval "use $klass"; |
|
1
|
|
|
|
|
7
|
|
|
1
|
|
|
|
|
46
|
|
|
1
|
|
|
|
|
96
|
|
73
|
|
|
|
|
|
|
|
74
|
1
|
50
|
|
|
|
10
|
if ($@) { |
75
|
0
|
|
|
|
|
0
|
die("Protocol Version $version not found. $@"); |
76
|
|
|
|
|
|
|
} |
77
|
|
|
|
|
|
|
|
78
|
1
|
|
|
|
|
13
|
return $klass->new(%option); |
79
|
|
|
|
|
|
|
} |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
1; |