> Tim Pushor wrote:
> 
> When I use $Response->Include('filename'), does this script execute as a perl block 
>or something? I notice that local variables are not visible
> inside the included file:
> 
> e.g.
> 
> sub callit {
>     my $var="test";
>     $Response->Include('file.inc');
> }
> 

file.inc is called as a subroutine.  It has its own scope.
To see the stack in an include, try 

 use Carp qw(cluck);
 cluck("VIEW STACK");

> The local variable is not available in the included file (so the file is not 
>*really* inlined). Do I need to use the @args to get stuff into the
> included file? How is that used?
> 

with a call like $Response->Include($file, @args)
@args is available in the include as normal perl args like

# file.inc
<% my @args = @_; %>

You can also pass data to an include via globals, so 
lets say you have set a global in your main script:

 use vars qw( $Global );
 $Global = 'value';

Then you could reference $Global in your include,
since includes and scripts are compiled into the same
perl package by default.  Good practice for globals
use is to declare them in the global.asa, and use
Script_OnStart to initialize them.  You could have
a global like %Vars that you use to pass around
generic script data, or construct a central application 
object like $App there too.  I would not create too
many globals, as this would be bad practice, but a few
key ones can be very helpful.

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

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to