summaryrefslogtreecommitdiff
path: root/FS/FS/ClientAPI.pm
diff options
context:
space:
mode:
Diffstat (limited to 'FS/FS/ClientAPI.pm')
-rw-r--r--FS/FS/ClientAPI.pm37
1 files changed, 37 insertions, 0 deletions
diff --git a/FS/FS/ClientAPI.pm b/FS/FS/ClientAPI.pm
new file mode 100644
index 000000000..902f58b31
--- /dev/null
+++ b/FS/FS/ClientAPI.pm
@@ -0,0 +1,37 @@
+package FS::ClientAPI;
+
+use strict;
+use vars qw(%handler $domain $DEBUG);
+
+$DEBUG = 0;
+
+%handler = ();
+
+#find modules
+foreach my $INC ( @INC ) {
+ my $glob = "$INC/FS/ClientAPI/*.pm";
+ warn "FS::ClientAPI: searching $glob" if $DEBUG;
+ foreach my $file ( glob($glob) ) {
+ $file =~ /\/(\w+)\.pm$/ or do {
+ warn "unrecognized ClientAPI file: $file";
+ next
+ };
+ my $mod = $1;
+ warn "using FS::ClientAPI::$mod" if $DEBUG;
+ eval "use FS::ClientAPI::$mod;";
+ die "error using FS::ClientAPI::$mod: $@" if $@;
+ }
+}
+
+#---
+
+sub dispatch {
+ my ( $self, $name ) = ( shift, shift );
+ $name =~ s(/)(::)g;
+ my $sub = "FS::ClientAPI::$name";
+ no strict 'refs';
+ &{$sub}(@_);
+}
+
+1;
+