raptor wrote:
>
> I'm doning something like this i.e. using include in many files :
>
> myscript1.asp, myscript2.asp, myscript3.asp ... myscriptX.asp
> ================================================
> <%
> ...code ...
> <!--#include file=blah.inc-->
> ...code...
> %>
>
> currently I have have some vars that are used inside <included>-files but
> has to declared into the outer script ( say myscript2.asp and
> myscript4.asp), but on the other hand I don't need to define them in all
> other scripts 'cause they don't use all of the functionality provided by
> blah.inc ... and 'cause I'm under 'strict' I have to define those virables
> in all scripts but not only in the script where I need them...
> One way to resolve this i've just tried (but has to go to bed :")) is to do
> the following :
>
> myscript2.asp, myscript4.asp
> ================================================
> <%
> ...code ...
> my $varThatINeedOnlyAtMyScript2 = 'xxx';
>
> <!--#include file=blah.inc-->
> ...code...
> %>
>
The way I like to do this is:
# global.asa
use Site;
use vars qw( $App ); # $App is global across scripts
sub Script_OnStart {
$App = Site->new(); # returns bless hash ref
}
# myscript2.asp
$App->{varThatINeedOnlyAtMyScript2} = something;
# blah.inc
$App->{varThatINeedOnlyAtMyScript2}...
If you like method instead of member access, like:
$App->varThatINeedOnlyAtMyScript2()
then you might use something like Class::Struct to define
your Site $App object with.
another way is to pass arguments to the include that
that include needs...
<% $Response->Include('blah.inc', $varThatINeedOnlyAtMyScript2) %>
then in blah.inc
<% my($varThatINeedOnlyAtMyScript2) = @_; %>
These approaches are not intuitive with ASP generally
because they rely on extensions specific to Apache::ASP.
--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]