We are currently performing a project to convert from ActivePerl/IIS
to Apache::ASP and have
run across issues with variables behaving strangely.  After searching
the web, I have a couple
of issues I would like some advice on.

1. Variable scope ...

>From the Apache::ASP page (Style Guide):
"One of perl's blessings is also its bane, variables do not need to be
declared, and are by default globally scoped. The problem with this in
mod_perl is that global variables persist from one request to another
even if a different web browser is viewing a page."

Our problem is the original authors of the code assumed variables are
not globally scoped.

Q1.1: How come in other languages, the scope of the variable is
assumed to be for the page unless
defined otherwise (e.g. PHP, ActivePerl, VBScript)?
Q1.2: Is there a configuration option or easy way around this issue?


2. Subroutines ...

>From the Apache::ASP page (Style Guide):
"DO NOT add subroutine declarations in scripts. Apache::ASP is
optimized by compiling a script into a subroutine for faster future
invocation."

We have ActivePerl Perlscript pages with
[sample.asp]
<%@ LANGUAGE = PerlScript%>
<!--#include virtual=[include.asp]-->

<%
my $foo = 1;
my $bar = 2;

my ($value) = &getValue($foo, $bar);

$Response->Write("Value = $value<br>\n");

%>
[end sample.asp]

[contents of include.asp]

<%

sub getValue
{
        my ($foo, $bar) = @_;
        
        my $value = $foo * $bar;

        return $value;
}

%>
[end include.asp]

Q2.1: Since this sub is included in sample.asp, is it considered a
subroutine within a subroutine?
Q2.2: Is there an easy way to convert include.asp to include.pm so I
can use "use include.pm" in our scripts?
Q2.3: Does Apache::ASP support #include virtual=...?  It only seems to
work with #include file=...




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

Reply via email to