From: ivan Date: Sat, 5 Feb 2005 23:39:43 +0000 (+0000) Subject: remove unnecessary complication from ClientAPI dispatch foo X-Git-Tag: BEFORE_FINAL_MASONIZE~717 X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=commitdiff_plain;h=85b4db91819ef43709a7d9728af3a7f1aa37b07a remove unnecessary complication from ClientAPI dispatch foo --- diff --git a/FS/FS/ClientAPI.pm b/FS/FS/ClientAPI.pm index 1109ede68..902f58b31 100644 --- a/FS/FS/ClientAPI.pm +++ b/FS/FS/ClientAPI.pm @@ -3,7 +3,7 @@ package FS::ClientAPI; use strict; use vars qw(%handler $domain $DEBUG); -$DEBUG = 1; +$DEBUG = 0; %handler = (); @@ -23,24 +23,13 @@ foreach my $INC ( @INC ) { } } -#(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}(@_); } diff --git a/FS/FS/ClientAPI/Agent.pm b/FS/FS/ClientAPI/Agent.pm index 749934d01..e4a58c0e6 100644 --- a/FS/FS/ClientAPI/Agent.pm +++ b/FS/FS/ClientAPI/Agent.pm @@ -10,14 +10,6 @@ use FS::Record qw(qsearchs); # qsearch dbdef dbh); 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', diff --git a/FS/FS/ClientAPI/MyAccount.pm b/FS/FS/ClientAPI/MyAccount.pm index c74f6ea9a..58966b3df 100644 --- a/FS/FS/ClientAPI/MyAccount.pm +++ b/FS/FS/ClientAPI/MyAccount.pm @@ -19,27 +19,6 @@ use FS::cust_bill; 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 diff --git a/FS/FS/ClientAPI/Signup.pm b/FS/FS/ClientAPI/Signup.pm index 0089e30ed..4947a645d 100644 --- a/FS/FS/ClientAPI/Signup.pm +++ b/FS/FS/ClientAPI/Signup.pm @@ -16,12 +16,6 @@ use FS::acct_snarf; use FS::queue; use FS::reg_code; -#use FS::ClientAPI; #hmm -FS::ClientAPI->register_handlers( - 'Signup/signup_info' => \&signup_info, - 'Signup/new_customer' => \&new_customer, -); - sub signup_info { my $packet = shift; diff --git a/FS/FS/ClientAPI/passwd.pm b/FS/FS/ClientAPI/passwd.pm index b5c098bd3..b22d7617e 100644 --- a/FS/FS/ClientAPI/passwd.pm +++ b/FS/FS/ClientAPI/passwd.pm @@ -5,13 +5,6 @@ use FS::Record qw(qsearchs); 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;