SourceForge has been redesigned. Learn more.
Close

Unsetting environment variables.

Help
Don Hughes
2005-01-27
2013-05-14
  • Don Hughes

    Don Hughes - 2005-01-27

    Using Regina on a Linux/Apache system for web page cgi programs, I have used the
    CALL VALUE 'some-name', 'some-value', 'SYSTEM'
    function to pass some general global information.

    I have traced some intermitent problems on a long running system to cluttering up the environment space. 
    CALL VALUE 'same-name',,'SYSTEM'
    does not drop the values, and setting them to ' '  just sets them to ' '. Duh.

    ADDRESS 'SYSTEM' 'printenv'
    will print them, but
    ADDRESS 'SYSTEM' 'unset same-name'
    will not delete them.

    Restarting Apache clears the environment, but is not a workable solution.

    How can I clean up the environment?

     
    • Jürgen Lange

      Jürgen Lange - 2005-03-10

      On my system (SuSE 8.2 - Apache 1.3.27)
      I cannot reproduce you're problem:
      #!/usr/bin/regina
      Say 'Content-type: text/html'
      Say
      Say '<html>'
      Say 'Value before='Value('bla',,'SYSTEM') '<br>'
      Call Value 'bla','test','SYSTEM'
      Say 'Value after='Value('bla',,'SYSTEM') '<br>'
      Say '</html>'

      gives:
      Value before=
      Value after=test

      i.e. the environment variable IS being deleted.
      Moreover the value of the env variable is NOT "inherited" accross successive calls of the script: each time the result is the same.

      You're right in that it seems to be impossible to distinguish between the value being the empty string '' and the value not being set at all.

       

Log in to post a comment.