From e60ef28577ec20d680661dcd580b89cfaec81edb Mon Sep 17 00:00:00 2001 From: erickson Date: Thu, 3 Mar 2005 21:17:52 +0000 Subject: [PATCH] removed some comments, added some sanity checking, trimmed down MathDB since json has better number handling git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@171 9efc2488-bf62-4759-914b-345cdb29e865 --- src/perlmods/OpenSRF/AppSession.pm | 14 --------- src/perlmods/OpenSRF/Application/Demo/Math.pm | 4 --- src/perlmods/OpenSRF/Application/Demo/MathDB.pm | 41 ++++++++++--------------- src/perlmods/OpenSRF/Application/Settings.pm | 5 +++ 4 files changed, 21 insertions(+), 43 deletions(-) diff --git a/src/perlmods/OpenSRF/AppSession.pm b/src/perlmods/OpenSRF/AppSession.pm index 99b26fe..6a12344 100644 --- a/src/perlmods/OpenSRF/AppSession.pm +++ b/src/perlmods/OpenSRF/AppSession.pm @@ -193,20 +193,6 @@ sub get_app_targets { } return @targets; - -=head comment - if( $app eq "settings" ) { # we have to load from the bootstrap config file - - if(!$conf) { die("No transport target for $app!"); } - $targets = $conf->targets->$app || die("No transport target for $app!"); - - } else { - $targets = $config_client->config_value("apps",$app,"transport_targets", "router_target"); - if( !ref($targets) ) { $targets = [ $targets ]; } - } - - return @$targets; -=cut } # When we're a client and we want to connect to a remote service diff --git a/src/perlmods/OpenSRF/Application/Demo/Math.pm b/src/perlmods/OpenSRF/Application/Demo/Math.pm index fe030a8..d217461 100644 --- a/src/perlmods/OpenSRF/Application/Demo/Math.pm +++ b/src/perlmods/OpenSRF/Application/Demo/Math.pm @@ -9,10 +9,6 @@ use strict; use warnings; -sub child_init { - OpenSRF::Application->method_lookup("opensrf.nunya"); -} - sub DESTROY{} our $log = 'OpenSRF::Utils::Logger'; diff --git a/src/perlmods/OpenSRF/Application/Demo/MathDB.pm b/src/perlmods/OpenSRF/Application/Demo/MathDB.pm index 6d0749e..eb90345 100644 --- a/src/perlmods/OpenSRF/Application/Demo/MathDB.pm +++ b/src/perlmods/OpenSRF/Application/Demo/MathDB.pm @@ -16,53 +16,44 @@ __PACKAGE__->register_method( method => 'add_1', api_name => 'dbmath.add' ); sub add_1 { my $self = shift; my $client = shift; - my @args = @_; - $log->debug("Adding @args", INTERNAL); - $log->debug("AppRequest is $client", INTERNAL); - my $n1 = shift; my $n2 = shift; - $n1 =~ s/\s+//; $n2 =~ s/\s+//; - my $a = $n1 + $n2; - return JSON::number::new($a); + my $n1 = shift; + my $n2 = shift; + my $a = $n1 + $n2; + return JSON::number->new($a); } __PACKAGE__->register_method( method => 'sub_1', api_name => 'dbmath.sub' ); sub sub_1 { my $self = shift; my $client = shift; - my @args = @_; - $log->debug("Subbing @args", INTERNAL); - $log->debug("AppRequest is $client", INTERNAL); - my $n1 = shift; my $n2 = shift; - $n1 =~ s/\s+//; $n2 =~ s/\s+//; + + my $n1 = shift; + my $n2 = shift; my $a = $n1 - $n2; - return JSON::number::new($a); + return JSON::number->new($a); } __PACKAGE__->register_method( method => 'mult_1', api_name => 'dbmath.mult' ); sub mult_1 { my $self = shift; my $client = shift; - my @args = @_; - $log->debug("Multiplying @args", INTERNAL); - $log->debug("AppRequest is $client", INTERNAL); - my $n1 = shift; my $n2 = shift; - $n1 =~ s/\s+//; $n2 =~ s/\s+//; + + my $n1 = shift; + my $n2 = shift; my $a = $n1 * $n2; - return JSON::number::new($a); + return JSON::number->new($a); } __PACKAGE__->register_method( method => 'div_1', api_name => 'dbmath.div' ); sub div_1 { my $self = shift; my $client = shift; - my @args = @_; - $log->debug("Dividing @args", INTERNAL); - $log->debug("AppRequest is $client", INTERNAL); - my $n1 = shift; my $n2 = shift; - $n1 =~ s/\s+//; $n2 =~ s/\s+//; + + my $n1 = shift; + my $n2 = shift; my $a = $n1 / $n2; - return JSON::number::new($a); + return JSON::number->new($a); } 1; diff --git a/src/perlmods/OpenSRF/Application/Settings.pm b/src/perlmods/OpenSRF/Application/Settings.pm index 989e09b..8c2e8d6 100644 --- a/src/perlmods/OpenSRF/Application/Settings.pm +++ b/src/perlmods/OpenSRF/Application/Settings.pm @@ -16,6 +16,11 @@ sub get_host_config { __PACKAGE__->register_method( method => 'xpath_get', api_name => 'opensrf.settings.xpath.get' ); + +__PACKAGE__->register_method( + method => 'xpath_get', + api_name => 'opensrf.settings.xpath.get.raw' ); + sub xpath_get { my($self, $client, $xpath) = @_; warn "*************** Received XPATH $xpath\n"; -- 2.11.0