Each called module might need module-wide arguments until return. This arguments are passed to the module like any other argument (see link()). New subsessions are opened automatically when the function arguments were tagged using view::set_caller().
Module-wide arguments are stored in $this->subargs. They're saved when calling a functions and restored when returning from it. Since all arguments are passed using link() the module-wide arguments must be stored in the subargs array first. This can be done doing a simple assignment at the start of an entry function of a module:
function my_module_entry (&$this) { # Save table name to subsession data. $table_name = $this->arg ('table_name', ARG_SUB); # Check other arguments. $this->arg ('txt_ok', ARG_SUB); $this->arg ('txt_error', ARG_SUB); # ... more code here ... }
Alls subsesession data is copied to the local database when the application exits in application::close ().