RT# 81961 Repair broken links in POD documentation
[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 $me );
6
7 @EXPORT_OK = qw( load_clientapi_modules );
8
9 $DEBUG = 0;
10 $me = '[FS::ClientAPI]';
11
12 %handler = ();
13
14 =head1 NAME
15
16 FS::ClientAPI
17
18 =item load_clientapi_modules
19
20 =cut
21
22 =cut
23
24 sub load_clientapi_modules {
25
26   #find modules
27   foreach my $INC ( @INC ) {
28     my $glob = "$INC/FS/ClientAPI/*.pm";
29     warn "FS::ClientAPI: searching $glob" if $DEBUG;
30     foreach my $file ( glob($glob) ) {
31       $file =~ /\/(\w+)\.pm$/ or do {
32         warn "unrecognized ClientAPI file: $file";
33         next
34       };
35       my $mod = $1;
36       warn "using FS::ClientAPI::$mod" if $DEBUG;
37       eval "use FS::ClientAPI::$mod;";
38       die "error using FS::ClientAPI::$mod: $@" if $@;
39     }
40   }
41
42 }
43
44 =item dispatch [ name ]
45
46 =cut
47
48 sub dispatch {
49   my ( $self, $name ) = ( shift, shift );
50   $name =~ s(/)(::)g;
51   my $sub = "FS::ClientAPI::$name";
52   warn "$me dispatch: calling $sub with args @_\n" if $DEBUG;
53   no strict 'refs';
54   &{$sub}(@_);
55 }
56
57 1;
58