Roxen.git / server / base_server / module.pike

version» Context lines:

Roxen.git/server/base_server/module.pike:1:   // This file is part of Roxen WebServer.   // Copyright © 1996 - 2001, Roxen IS. - // $Id: module.pike,v 1.125 2001/08/23 18:05:05 nilsson Exp $ + // $Id: module.pike,v 1.126 2001/08/23 18:40:14 mast Exp $      #include <module_constants.h>   #include <module.h>   #include <request_trace.h>      constant __pragma_save_parent__ = 1;      inherit "basic_defvar";   mapping(string:array(int)) error_log=([]);      constant is_module = 1;   // constant module_type = MODULE_ZERO;   // constant module_name = "Unnamed module";   // constant module_doc = "Undocumented";   constant module_unique = 1;         private Configuration _my_configuration; -  + private string _module_local_identifier;   private string _module_identifier =    lambda() {    mixed init_info = roxen->bootstrap_info->get();    if (arrayp (init_info)) { -  [_my_configuration, string modname] = init_info; -  return _my_configuration->name + "/" + modname; +  [_my_configuration, _module_local_identifier] = init_info; +  return _my_configuration->name + "/" + _module_local_identifier;    }    }();   static mapping _api_functions = ([]);      string|array(string) module_creator;   string module_url;   RXML.TagSet module_tag_set;      /* These functions exists in here because otherwise the messages in    * the event log does not always end up in the correct
Roxen.git/server/base_server/module.pike:40:    * roxenlib.pike cannot see that they are logged from a module. This    * solution is not really all that beautiful, but it works. :-)    */   void report_fatal( mixed ... args ) { predef::report_fatal( @args ); }   void report_error( mixed ... args ) { predef::report_error( @args ); }   void report_notice( mixed ... args ) { predef::report_notice( @args ); }   void report_debug( mixed ... args ) { predef::report_debug( @args ); }         string module_identifier() + //! Returns a string that uniquely identifies this module instance + //! within the server. The identifier is the same as + //! @[Roxen.get_module] and @[Roxen.get_modname] handles.   {   #if 1    return _module_identifier;   #else    if (!_module_identifier) {    string|mapping name = this_object()->register_module()[1];    if (mappingp (name)) name = name->standard;    string cname = sprintf ("%O", my_configuration());    if (sscanf (cname, "Configuration(%s", cname) == 1 &&    sizeof (cname) && cname[-1] == ')')    cname = cname[..sizeof (cname) - 2];    _module_identifier = sprintf ("%s,%s",    name||this_object()->module_name, cname);    }    return _module_identifier;   #endif   }    -  + string module_local_id() + //! Returns a string that uniquely identifies this module instance + //! within the configuration. The returned string is the same as the + //! part after the first '/' in the one returned from + //! @[module_identifier]. + { +  return _module_local_identifier; + } +    RoxenModule this_module()   {    return this_object(); // To be used from subclasses.   }      string _sprintf()   {    return sprintf ("RoxenModule(%s)", _module_identifier || "?");   }