use strict;
use vars qw(%handler $domain $DEBUG);
-$DEBUG = 1;
+$DEBUG = 0;
%handler = ();
}
}
-#(sub for modules)
-sub register_handlers {
- my $self = shift;
- my %new_handlers = @_;
- foreach my $key ( keys %new_handlers ) {
- warn "WARNING: redefining sub $key" if exists $handler{$key};
- #warn "registering $key";
- $handler{$key} = $new_handlers{$key};
- }
-}
-
#---
sub dispatch {
my ( $self, $name ) = ( shift, shift );
- my $sub = $handler{$name}
- or die "unknown FS::ClientAPI sub $name (known: ". join(" ", keys %handler );
- #or die "unknown FS::ClientAPI sub $name";
+ $name =~ s(/)(::)g;
+ my $sub = "FS::ClientAPI::$name";
+ no strict 'refs';
&{$sub}(@_);
}
use FS::agent;
use FS::cust_main qw(smart_search);
-#use FS::ClientAPI;
-FS::ClientAPI->register_handlers(
- 'Agent/agent_login' => \&agent_login,
- 'Agent/agent_logout' => \&agent_logout,
- 'Agent/agent_info' => \&agent_info,
- 'Agent/agent_list_customers' => \&agent_list_customers,
-);
-
#store in db?
my $cache = new Cache::SharedMemoryCache( {
'namespace' => 'FS::ClientAPI::Agent',
use FS::cust_main_county;
use FS::cust_pkg;
-#use FS::ClientAPI; #hmm
-FS::ClientAPI->register_handlers(
- 'MyAccount/login' => \&login,
- 'MyAccount/logout' => \&logout,
- 'MyAccount/customer_info' => \&customer_info,
- 'MyAccount/edit_info' => \&edit_info,
- 'MyAccount/invoice' => \&invoice,
- 'MyAccount/list_invoices' => \&list_invoices,
- 'MyAccount/cancel' => \&cancel,
- 'MyAccount/payment_info' => \&payment_info,
- 'MyAccount/process_payment' => \&process_payment,
- 'MyAccount/list_pkgs' => \&list_pkgs,
- 'MyAccount/order_pkg' => \&order_pkg,
- 'MyAccount/cancel_pkg' => \&cancel_pkg,
- 'MyAccount/charge' => \&charge,
- 'MyAccount/part_svc_info' => \&part_svc_info,
- 'MyAccount/provision_acct' => \&provision_acct,
- 'MyAccount/provision_external' => \&provision_external,
- 'MyAccount/unprovision_svc' => \&unprovision_svc,
-);
-
use vars qw( @cust_main_editable_fields );
@cust_main_editable_fields = qw(
first last company address1 address2 city
use FS::svc_acct;
use FS::svc_domain;
-#use FS::ClientAPI; #hmm
-FS::ClientAPI->register_handlers(
- 'passwd/passwd' => \&passwd,
- 'passwd/chfn' => \&chfn,
- 'passwd/chsh' => \&chsh,
-);
-
sub passwd {
my $packet = shift;