registering classes during load and introspection
authormiker <miker@9efc2488-bf62-4759-914b-345cdb29e865>
Mon, 7 Mar 2005 17:15:32 +0000 (17:15 +0000)
committermiker <miker@9efc2488-bf62-4759-914b-345cdb29e865>
Mon, 7 Mar 2005 17:15:32 +0000 (17:15 +0000)
git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@189 9efc2488-bf62-4759-914b-345cdb29e865

src/perlmods/OpenSRF/Application.pm
src/perlmods/OpenSRF/System.pm

index af04c46..ee4648a 100644 (file)
@@ -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;
index 695d27b..4a1e138 100644 (file)
@@ -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" );