diff options
author | Mike Mazur | 2009-01-28 01:56:04 +0000 |
---|---|---|
committer | Mike Mazur | 2009-01-28 01:56:04 +0000 |
commit | fefe0ff3d9ceaaefccb494ef13a5a98cc0131070 (patch) | |
tree | 01c5057fb9f23c55f07ff102906f5f14d6453118 /ThirdParty/3Di/RegionMonitor/MonitorGUI/htdocs/XML | |
parent | Slight cleanup of docs, removing trailing whitespace. (diff) | |
download | opensim-SC-fefe0ff3d9ceaaefccb494ef13a5a98cc0131070.zip opensim-SC-fefe0ff3d9ceaaefccb494ef13a5a98cc0131070.tar.gz opensim-SC-fefe0ff3d9ceaaefccb494ef13a5a98cc0131070.tar.bz2 opensim-SC-fefe0ff3d9ceaaefccb494ef13a5a98cc0131070.tar.xz |
Removing contents of ThirdParty/3Di. The load balancer can now be found
at http://forge.opensimulator.org/gf/project/loadbalancer/
config key: svn.rmdir
Diffstat (limited to 'ThirdParty/3Di/RegionMonitor/MonitorGUI/htdocs/XML')
-rw-r--r-- | ThirdParty/3Di/RegionMonitor/MonitorGUI/htdocs/XML/RPC.pm | 100 |
1 files changed, 0 insertions, 100 deletions
diff --git a/ThirdParty/3Di/RegionMonitor/MonitorGUI/htdocs/XML/RPC.pm b/ThirdParty/3Di/RegionMonitor/MonitorGUI/htdocs/XML/RPC.pm deleted file mode 100644 index 5d9b388..0000000 --- a/ThirdParty/3Di/RegionMonitor/MonitorGUI/htdocs/XML/RPC.pm +++ /dev/null | |||
@@ -1,100 +0,0 @@ | |||
1 | package XML::RPC; | ||
2 | |||
3 | use strict; | ||
4 | use Carp; | ||
5 | use RPC::XML; | ||
6 | use RPC::XML::Parser; | ||
7 | use RPC::XML::Client; | ||
8 | |||
9 | sub new { | ||
10 | my ($this, $url) = @_; | ||
11 | my %fields = ( | ||
12 | parser => new RPC::XML::Parser(), | ||
13 | url => $url, | ||
14 | ); | ||
15 | return bless \%fields, $this; | ||
16 | } | ||
17 | |||
18 | sub receive { | ||
19 | my ($this, $xmldata, $handler) = @_; | ||
20 | my $response = undef; | ||
21 | eval { | ||
22 | my $request = $this->{parser}->parse($xmldata); | ||
23 | my @args = map {$_->value} @{$request->args}; | ||
24 | $response = $handler->($request->{name}, @args); | ||
25 | }; | ||
26 | if ($@) { | ||
27 | my %error = ( | ||
28 | "error" => "ERROR", | ||
29 | "message" => $@, | ||
30 | ); | ||
31 | $response = \%error; | ||
32 | } | ||
33 | if ( ref($response) eq "RPC::XML::response" ) { | ||
34 | return $response->as_string; | ||
35 | } | ||
36 | else { | ||
37 | return RPC::XML::response->new($response)->as_string; | ||
38 | } | ||
39 | } | ||
40 | |||
41 | sub call { | ||
42 | my ($this, $method_name, $param) = @_; | ||
43 | if (!$this->{url}) { | ||
44 | Carp::croak("XMLRPC: url not set for calling $method_name"); | ||
45 | } | ||
46 | my $client = RPC::XML::Client->new($this->{url}); | ||
47 | my $request_param = undef; | ||
48 | my $req = undef; | ||
49 | if (ref $param eq "ARRAY") { | ||
50 | $request_param = &_make_array_param($param); | ||
51 | $req = RPC::XML::request->new( | ||
52 | $method_name, | ||
53 | @$request_param, | ||
54 | ); | ||
55 | } elsif (ref $param eq "HASH"){ | ||
56 | $request_param = &_make_hash_param($param); | ||
57 | $req = RPC::XML::request->new( | ||
58 | $method_name, | ||
59 | $request_param, | ||
60 | ); | ||
61 | } else { | ||
62 | Carp::croak("unexpected param type"); | ||
63 | } | ||
64 | my $rpc_res = undef; | ||
65 | eval { | ||
66 | $rpc_res = $client->send_request($req); | ||
67 | }; | ||
68 | if ($@) { | ||
69 | Carp::croak("request " . $this->{url} . "/" . $method_name . " failed. $@" ); | ||
70 | } | ||
71 | if (ref($rpc_res) eq "RPC::XML::struct") { | ||
72 | my %res = map { $_ => $rpc_res->{$_}->value } keys %$rpc_res; # remember good perl !! | ||
73 | return \%res; | ||
74 | } elsif (ref($rpc_res) eq "RPC::XML::string") { | ||
75 | return $rpc_res->value; | ||
76 | } else { | ||
77 | return undef; | ||
78 | } | ||
79 | } | ||
80 | |||
81 | sub _make_array_param { | ||
82 | my $param = shift; | ||
83 | my @array_param = (); | ||
84 | foreach (@$param) { | ||
85 | push @array_param, RPC::XML::string->new($_); # @@@ only string type | ||
86 | } | ||
87 | return \@array_param; | ||
88 | } | ||
89 | |||
90 | sub _make_hash_param { | ||
91 | my $param = shift; | ||
92 | my %hash_param = (); | ||
93 | foreach (keys %$param) { | ||
94 | $hash_param{$_} = RPC::XML::string->new($param->{$_}); # @@@ only string type | ||
95 | } | ||
96 | return RPC::XML::struct->new(\%hash_param); | ||
97 | } | ||
98 | |||
99 | 1; | ||
100 | |||