From bcb2a94ae6772c1b3e918efe319647ff41002f8a Mon Sep 17 00:00:00 2001 From: erickson Date: Tue, 15 Feb 2005 19:18:47 +0000 Subject: [PATCH] changed unixserver app retrieval git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@55 9efc2488-bf62-4759-914b-345cdb29e865 --- src/perlmods/OpenSRF/Application.pm | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/src/perlmods/OpenSRF/Application.pm b/src/perlmods/OpenSRF/Application.pm index 9a69be8..72d27b4 100644 --- a/src/perlmods/OpenSRF/Application.pm +++ b/src/perlmods/OpenSRF/Application.pm @@ -1,5 +1,5 @@ package OpenSRF::Application; -use vars qw/$_app $log @_METHODS $thunk//; +use vars qw/$_app $log @_METHODS $thunk $server_class/; use base qw/OpenSRF/; use OpenSRF::AppSession; @@ -9,7 +9,9 @@ use OpenSRF::Utils::Logger qw/:level/; use Data::Dumper; use Time::HiRes qw/time/; use OpenSRF::EX qw/:try/; -use OpenSRF::UnixServer; # to get the server class from UnixServer::App +#use OpenSRF::UnixServer; # to get the server class from UnixServer::App + +sub DESTROY{}; use strict; use warnings; @@ -19,6 +21,14 @@ $log = 'OpenSRF::Utils::Logger'; our $in_request = 0; our @pending_requests; +sub server_class { + my $class = shift; + if($class) { + $server_class = $class; + } + return $server_class; +} + sub thunk { my $self = shift; my $flag = shift; @@ -203,8 +213,9 @@ sub register_method { $args{stream} ||= 0; $args{remote} ||= 0; $args{package} ||= $app; - $args{api_name} ||= UnixServer->app() . '.' . $args{method}; - $args{server_class} ||= UnixServer->app(); + $args{server_class} = server_class(); + $args{api_name} ||= $args{server_class} . '.' . $args{method}; + $args{code} ||= \&{$app . '::' . $args{method}}; $_METHODS[$args{api_level}]{$args{api_name}} = bless \%args => $app; @@ -212,7 +223,7 @@ sub register_method { stream => 0, api_name => $args{api_name}.'.atomic', method => 'make_stream_atomic' - ) if ($stream); + ) if ($args{stream}); } sub retrieve_remote_apis { @@ -278,7 +289,7 @@ sub method_lookup { my $class = ref($self) || $self; $log->debug("Lookup of [$method] by [$class]", DEBUG); - $log->debug("Available methods\n".Dumper(\%_METHODS), INTERNAL); + $log->debug("Available methods\n".Dumper(\@_METHODS), INTERNAL); my $meth; if (__PACKAGE__->thunk) { -- 2.11.0