help files
Z505 | PasWiki | FUQ | Search | Main Docs | API Guide



[Overview][Constants][Procedures and functions] Reference for unit 'pwumain' (#powtils_main)

SetCfgVar

Declaration

Source position: pwumain.pas line 97

function SetCfgVar(

  const name: String;

  const value: String

):Boolean;

Notes

This function sets up a configuration variable (variables as seen in pwu_unix.conf or pwu_win.conf). Instead of calling SetCfgVar, you can simply use a config file instead.

In later versions of Powtils (1.7.x) you must edit pwinit.pas to initialize the config file to be used (see pwinitall.pas for an example). Therefore if you are not using a config file, this SetCfgVar() function is handy for setting configuration up inside your program, without the need for a text config file.

Setting a Config Var

As a general guideline, one should set the web configuration variable before making any output calls (webwrite, etc.). Some variables such as error reporting on/off and error halting on/off can be set between output calls on the fly though.

The web config variables that can be set are:

In versions 1.6.0.2 and earlier, setting some of the above config variables with the SetWebConfigVar function will not have any effect, such as session_path, session_life_time. In later versions such as 1.6.1 these however can be set, but only before making output calls to procedures such as webwrite.

Example

begin
  // if we want to halt instead of continuing 
  setcfgvar('error_halt' 'on')
  outln('Hello <br>');
  //  we specify an invalid file
  fileout('badfile.aaa');
  // program should halt above, cannot find file
  outln('<br>');
  outln('Did program halt? Is this message visible?');
end.





lufdoc, Powtils, fpc, freepascal, delphi, kylix, c/c++, mysql, cgi web framework docs, Z505