This commit was generated by cvs2svn to compensate for changes in r4407,
[freeside.git] / FS / FS / ClientAPI.pm
1 package FS::ClientAPI;
2
3 use strict;
4 use vars qw(%handler $domain $DEBUG);
5
6 $DEBUG = 0;
7
8 %handler = ();
9
10 #find modules
11 foreach my $INC ( @INC ) {
12   my $glob = "$INC/FS/ClientAPI/*.pm";
13   warn "FS::ClientAPI: searching $glob" if $DEBUG;
14   foreach my $file ( glob($glob) ) {
15     $file =~ /\/(\w+)\.pm$/ or do {
16       warn "unrecognized ClientAPI file: $file";
17       next
18     };
19     my $mod = $1;
20     warn "using FS::ClientAPI::$mod" if $DEBUG;
21     eval "use FS::ClientAPI::$mod;";
22     die "error using FS::ClientAPI::$mod: $@" if $@;
23   }
24 }
25
26 #---
27
28 sub dispatch {
29   my ( $self, $name ) = ( shift, shift );
30   $name =~ s(/)(::)g;
31   my $sub = "FS::ClientAPI::$name";
32   no strict 'refs';
33   &{$sub}(@_);
34 }
35
36 1;
37