Simon Oliver wrote:
> 

The Apache::ASP mailing list is at [EMAIL PROTECTED] ... please subscribe
to it to post questions on this topic by emailing [EMAIL PROTECTED]
Apache::ASP dev issues are officially off-topic on the mod_perl list now.

More below on this issue...

> In my httpd.conf I have set 'PerlSetVar UseStrict 1' because I always use
> sctict anyway and I see in the docs that this might become the default
> too.  So I always declare my variables with my().
> 
> Suppose I have a master ASP file that includes other scripts and these
> other scripts need access to the variables declrared in the master - no
> problem.  But reading through the docs it looks like turning on
> DynamicIncludes would save alot of memory and be generally more
> efficient.
> 
> Indeed, it would also "protect" the variables declared in one file from
> another because the includes are compliled and called as seperate subs.
> And here lies the problem, how to declare a vaiable in the master ASP file
> that is also in the scope of the dynamic include?
> 

You can stick with inline includes as you are doing, but DynamicIncludes
are good, and you can pass values into them as subroutines:

  $Response->Includes($file, @args);

# in $file
<% my @args = @_; %>

Just like a normal perl subroutine.  For more on this, please see:
  http://www.apache-asp.org/objects.html#%24Response-%3EI2a8df2f3

You can also use globals, which you can declare for your entire 
application in your global.asa

# global.asa
use vars qw($Var1 $Var2);

sub Script_OnStart {
  $Var1 = '';
  $Var2 = 0;
}

I would strongly suggest you use locally scoped my() variables
when possibly passing as @args to an include, but sometimes 
having a global can be handy which is why I mention the latter.

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

Reply via email to