From: miker Date: Mon, 7 Mar 2005 17:15:32 +0000 (+0000) Subject: registering classes during load and introspection X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=8358c6b29b028b772d494cb8a53004411f7a70c4;p=opensrf%2Fbjwebb.git registering classes during load and introspection git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@189 9efc2488-bf62-4759-914b-345cdb29e865 --- diff --git a/src/perlmods/OpenSRF/Application.pm b/src/perlmods/OpenSRF/Application.pm index af04c46..ee4648a 100644 --- a/src/perlmods/OpenSRF/Application.pm +++ b/src/perlmods/OpenSRF/Application.pm @@ -219,10 +219,13 @@ sub register_method { $args{stream} ||= 0; $args{remote} ||= 0; $args{package} = $app; - $args{object_hint} ||= ''; $args{server_class} = server_class(); $args{api_name} ||= $args{server_class} . '.' . $args{method}; + unless ($args{object_hint}) { + ($args{object_hint} = $args{package}) =~ s/::/_/go; + } + JSON->register_class_hint( name => $args{package}, hint => $args{object_hint}, type => "hash" ); $_METHODS[$args{api_level}]{$args{api_name}} = bless \%args => $app; diff --git a/src/perlmods/OpenSRF/System.pm b/src/perlmods/OpenSRF/System.pm index 695d27b..4a1e138 100644 --- a/src/perlmods/OpenSRF/System.pm +++ b/src/perlmods/OpenSRF/System.pm @@ -124,7 +124,7 @@ sub load_bootstrap_config { OpenSRF::Utils::Config->load( config_file => $bootstrap_config_file ); - JSON->register_class_hint( name => "OpenSRF::Application", hint => "", type => "hash" ); + JSON->register_class_hint( name => "OpenSRF::Application", hint => "method", type => "hash" ); OpenSRF::Transport->message_envelope( "OpenSRF::Transport::SlimJabber::MessageWrapper" ); OpenSRF::Transport::PeerHandle->set_peer_client( "OpenSRF::Transport::SlimJabber::PeerConnection" );