freeside/FS/FS XMLRPC.pm,1.3,1.4
Kristian Hoffmann
khoff at pouncequick.420.am
Thu Mar 10 14:49:46 PST 2005
Update of /home/cvs/cvsroot/freeside/FS/FS
In directory pouncequick:/tmp/cvs-serv29833/FS/FS
Modified Files:
XMLRPC.pm
Log Message:
Add the ability to do freeside configuration lookups through the XMLRPC interface.
Index: XMLRPC.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/XMLRPC.pm,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- XMLRPC.pm 8 Mar 2005 18:37:31 -0000 1.3
+++ XMLRPC.pm 10 Mar 2005 22:49:43 -0000 1.4
@@ -7,6 +7,7 @@
# Instead of 'use'ing freeside modules on the fly below, just preload them now.
use FS;
use FS::CGI;
+use FS::Conf;
use FS::Record;
use FS::cust_main;
@@ -96,23 +97,37 @@
warn "fssub: ${fssub}" if $DEBUG;
warn "params: " . Dumper($params) if $DEBUG;
- unless (UNIVERSAL::can("FS::${class}", $sub)) {
- warn "FS::XMLRPC: Can't call undefined subroutine '${fssub}'";
- # Should we encode an error in the response,
- # or just break silently to the remote caller and complain locally?
- return [];
- }
-
my @result;
- eval {
- no strict 'refs';
- my $fssub = "FS::${class}::${sub}";
- @result = (&$fssub(@$params));
- };
- if ($@) {
- warn "FS::XMLRPC: Error while calling '${fssub}': $@";
- return [];
+ if ($class eq 'Conf') { #Special case for FS::Conf because we need an obj.
+
+ if ($sub eq 'config') {
+ my $conf = new FS::Conf;
+ @result = ($conf->config(@$params));
+ } else {
+ warn "FS::XMLRPC: Can't call undefined subroutine '${fssub}'";
+ }
+
+ } else {
+
+ unless (UNIVERSAL::can("FS::${class}", $sub)) {
+ warn "FS::XMLRPC: Can't call undefined subroutine '${fssub}'";
+ # Should we encode an error in the response,
+ # or just break silently to the remote caller and complain locally?
+ return [];
+ }
+
+ eval {
+ no strict 'refs';
+ my $fssub = "FS::${class}::${sub}";
+ @result = (&$fssub(@$params));
+ };
+
+ if ($@) {
+ warn "FS::XMLRPC: Error while calling '${fssub}': $@";
+ return [];
+ }
+
}
warn Dumper(@result);
More information about the freeside-commits
mailing list