Loading ...
Sorry, an error occurred while loading the content.
 

Re: Global (to page) variables under Apache::ASP

Expand Messages
  • Joshua Chamas
    ... Yes, Script_OnStart will get run each request. NoState 1 would turn off $Session & $Application events & those objects themselves. ... Any global set in a
    Message 1 of 2 , Apr 23, 2002
      Simon Oliver wrote:
      >
      > Joshua Chamas wrote:
      >
      > > $Response->Includes($file, @args);
      > The @args advice works well.
      >
      > > # global.asa
      > > use vars qw($Var1 $Var2);
      > >
      > > sub Script_OnStart {
      > > $Var1 = '';
      > > $Var2 = 0;
      > > }
      > Does the Script_OnStart event get called even if I have 'NoState 0'?
      >

      Yes, Script_OnStart will get run each request. NoState 1 would
      turn off $Session & $Application events & those objects themselves.

      > Eitherway, there must be a way to inject variables into the scripts name
      > space, something like:
      >
      > $script_name_space::Var1 = 'blah';

      Any global set in a script will be seen everywhere else.
      If you want to referecence the script package directly, set

      PerlSetVar GlobalPackage Some::Module

      then you can get to these variables like:

      $Some::Module::var

      just the same as

      $var

      in a script. Note also that all of the ASP objects get set
      in the main package each request, so you can also:

      $main::Response->Write()

      and the like. This is useful when you find yourself in some package
      like an XMLSubs when you no longer can access $Request directly.

      --Josh

      _________________________________________________________________
      Joshua Chamas Chamas Enterprises Inc.
      NodeWorks Founder Huntington Beach, CA USA
      http://www.nodeworks.com 1-714-625-4051

      ---------------------------------------------------------------------
      To unsubscribe, e-mail: asp-unsubscribe@...
      For additional commands, e-mail: asp-help@...
    Your message has been successfully submitted and would be delivered to recipients shortly.