-#find modules
-foreach my $INC ( @INC ) {
- foreach my $file ( glob("$INC/FS/ClientAPI/*.pm") ) {
- $file =~ /\/(\w+)\.pm$/ or do {
- warn "unrecognized ClientAPI file: $file";
- next
- };
- my $mod = $1;
- #warn "using FS::ClientAPI::$mod";
- eval "use FS::ClientAPI::$mod;";
- die "error using FS::ClientAPI::$mod: $@" if $@;
+sub load_clientapi_modules {
+
+ #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 $@;
+ }