1Frontier::Client(3) User Contributed Perl Documentation Frontier::Client(3)
2
3
4
6 Frontier::Client - issue Frontier XML RPC requests to a server
7
9 use Frontier::Client;
10
11 $server = Frontier::Client->new( I<OPTIONS> );
12
13 $result = $server->call($method, @args);
14
15 $boolean = $server->boolean($value);
16 $date_time = $server->date_time($value);
17 $base64 = $server->base64($value);
18
19 $value = $boolean->value;
20 $value = $date_time->value;
21 $value = $base64->value;
22
24 Frontier::Client is an XML-RPC client over HTTP. Frontier::Client
25 instances are used to make calls to XML-RPC servers and as shortcuts
26 for creating XML-RPC special data types.
27
29 new( OPTIONS )
30 Returns a new instance of Frontier::Client and associates it with
31 an XML-RPC server at a URL. OPTIONS may be a list of key, value
32 pairs or a hash containing the following parameters:
33
34 url The URL of the server. This parameter is required. For
35 example:
36
37 $server = Frontier::Client->new( 'url' => 'http://betty.userland.com/RPC2' );
38
39 proxy
40 A URL of a proxy to forward XML-RPC calls through.
41
42 encoding
43 The XML encoding to be specified in the XML declaration of
44 outgoing RPC requests. Incoming results may have a different
45 encoding specified; XML::Parser will convert incoming data to
46 UTF-8. The default outgoing encoding is none, which uses XML
47 1.0's default of UTF-8. For example:
48
49 $server = Frontier::Client->new( 'url' => 'http://betty.userland.com/RPC2',
50 'encoding' => 'ISO-8859-1' );
51
52 use_objects
53 If set to a non-zero value will convert incoming <i4>, <float>,
54 and <string> values to objects instead of scalars. See int(),
55 float(), and string() below for more details.
56
57 username
58 Sets the username for basic authentication. If this is not set,
59 basic authentication will be disabled.
60
61 password
62 Sets the password for basic authentication.
63
64 debug
65 If set to a non-zero value will print the encoded XML request
66 and the XML response received.
67
68 call($method, @args)
69 Forward a procedure call to the server, either returning the value
70 returned by the procedure or failing with exception. `$method' is
71 the name of the server method, and `@args' is a list of arguments
72 to pass. Arguments may be Perl hashes, arrays, scalar values, or
73 the XML-RPC special data types below.
74
75 boolean( $value )
76 date_time( $value )
77 base64( $base64 )
78 The methods `"boolean()"', `"date_time()"', and `"base64()"' create
79 and return XML-RPC-specific datatypes that can be passed to
80 `"call()"'. Results from servers may also contain these datatypes.
81 The corresponding package names (for use with `"ref()"', for
82 example) are `"Frontier::RPC2::Boolean"',
83 `"Frontier::RPC2::DateTime::ISO8601"', and
84 `"Frontier::RPC2::Base64"'.
85
86 The value of boolean, date/time, and base64 data can be set or
87 returned using the `"value()"' method. For example:
88
89 # To set a value:
90 $a_boolean->value(1);
91
92 # To retrieve a value
93 $base64 = $base64_xml_rpc_data->value();
94
95 Note: `"base64()"' does not encode or decode base64 data for you,
96 you must use MIME::Base64 or similar module for that.
97
98 int( 42 );
99 float( 3.14159 );
100 string( "Foo" );
101 By default, you may pass ordinary Perl values (scalars) to be
102 encoded. RPC2 automatically converts them to XML-RPC types if they
103 look like an integer, float, or as a string. This assumption
104 causes problems when you want to pass a string that looks like
105 "0096", RPC2 will convert that to an <i4> because it looks like an
106 integer. With these methods, you could now create a string object
107 like this:
108
109 $part_num = $server->string("0096");
110
111 and be confident that it will be passed as an XML-RPC string. You
112 can change and retrieve values from objects using value() as
113 described above.
114
116 perl(1), Frontier::RPC2(3)
117
118 <http://www.scripting.com/frontier5/xml/code/rpc.html>
119
121 Ken MacLeod <ken@bitsko.slc.ut.us> Basic authentication patch by Jeff
122 <jeff@freemedsoftware.org>
123
124
125
126perl v5.10.1 2017-03-22 Frontier::Client(3)