communigate provisioning phase 2: Domain:Account Defaults:Settings: RulesAllowed...
[freeside.git] / FS / FS / ClientAPI.pm
1 package FS::ClientAPI;
2
3 use strict;
4 use base 'Exporter';
5 use vars qw( @EXPORT_OK %handler $domain $DEBUG );
6
7 @EXPORT_OK = qw( load_clientapi_modules );
8
9 $DEBUG = 0;
10
11 %handler = ();
12
13 sub load_clientapi_modules {
14
15   #find modules
16   foreach my $INC ( @INC ) {
17     my $glob = "$INC/FS/ClientAPI/*.pm";
18     warn "FS::ClientAPI: searching $glob" if $DEBUG;
19     foreach my $file ( glob($glob) ) {
20       $file =~ /\/(\w+)\.pm$/ or do {
21         warn "unrecognized ClientAPI file: $file";
22         next
23       };
24       my $mod = $1;
25       warn "using FS::ClientAPI::$mod" if $DEBUG;
26       eval "use FS::ClientAPI::$mod;";
27       die "error using FS::ClientAPI::$mod: $@" if $@;
28     }
29   }
30
31 }
32
33 sub dispatch {
34   my ( $self, $name ) = ( shift, shift );
35   $name =~ s(/)(::)g;
36   my $sub = "FS::ClientAPI::$name";
37   no strict 'refs';
38   &{$sub}(@_);
39 }
40
41 1;
42