× Warning! This forum is in archival status. New contributions may not work.
module development and variable name space ?.
  • Hello,


    do you think you can write these things into a coherent outline for
    the API? frankly, i don't understand a word, so the question is: how much
    more common sense can we supply before this leaves the realm of human
    comprehension and becomes functional?

    >Thinking more about the $MODULE idea :
    >
    >I'm thinking we should use a singleton class instead of a raw array for
    >this feature. Under the hood we could use the $MODULE["modname"] if we
    >want. (Though we might want to use $CAMP_MODULE instead for the
    >name.) This class would allow interaction between modules and provide an
    >easy way to find out which modules are installed. Any module would
    >inherit from the Camp_Module class. Here is a really rough sketch. I'm
    >sure we can do a lot more with it:
    >
    >class Camp_ModuleManager {
    > var $m_moduleObjects = array();
    >
    > function Camp_ModuleManager() { }
    >
    > function registerModule($p_campModule) {
    > $this->m_moduleObjects[$p_campModule->getName()] =
    > $p_campModule;
    > }
    >
    > function getAllModules() {
    > return array_keys($this->m_moduleObjects);
    > }
    >
    > function getModule($p_name) {
    > return $this->m_moduleObjects[$p_name];
    > }
    >
    > function beginRequest($p_request, $p_session, $p_files) {
    > // go through all the modules
    > foreach ($this->m_moduleObjects as $mod) {
    > $mod->beginRequest($p_request,
    > $p_session, $p_files);
    > }
    > }
    >
    > function endRequest($p_request, $p_session, $p_files) {
    > // go through all the modules
    > foreach ($this->m_moduleObjects as $mod) {
    > $mod->endRequest($p_request,
    > $p_session, $p_files);
    > }
    > }
    >} // class Camp_ModuleManager
    >

    thanks
    jackyjoy