Thanks Joshua, you're the man.  I haven't tried the solution
but I'm sure it's related.  I wasn't aware of the way the
individual .asp scripts worked (as subroutines that is).
By the way, have you ever considered adding a pre-parsing
step where you first read in all the subroutines separately
(say, up to the first line of code) and place them before
the actual subroutine that will become main and will denote
the script itself?  That could be a life-saver!  I believe
that's how the ATG-Dynamo people did it... Dynamo is a Java
(no booing please) -based app server where the scripts
(identical to jsp's) are precompiled as their own "classes"
and then executed.  In their case I believe they do that
preparsing I mentioned except that in Java I don't think
it makes much of a difference! Oh well, Perl : 4654574,
Java : 1 !

I hate to digress again but although I understand the
"closure" deal, why does it persist?  In one execution I
understand having that problem of not refreshing the
value but why in subsequent executions as well?  Shouldn't
those values disappear by that point?  I had it where I
was adding elements to an array in the $arr[$#arr] fashion
and if I pressed the refresh button fast enough the array
would grow in size by the size of the original array!  I'm
pretty sure what server thread you're on makes a difference.
So if you have three threads with the underlined being the
active one here's what would happen to the array size if I
added ten elements to $arr by saying $arr[$#arr] = x;
_10_ 0 0
10 0 _10_
10 _10_ 10
10 10 _20_
_20_ 10 20

etc, etc.

WEIRD!!!

Anyway, I'll verify "use strict" is turned on although I'm
pretty sure I configured it initially that way.  Moreover
I'll look into extracting one of the forms' subs and putting
them in a perl lib.  If that does it I'll let you know.

Thanks,
Demetrios

-----Original Message-----
From: Joshua Chamas [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, September 20, 2000 8:09 PM
To: Demetrios C. Christopher
Cc: [EMAIL PROTECTED]
Subject: Re: Apache::ASP : perl variables tend to "stick" ...


Oops, sorry for the last send, itchy trigger finger. :)

This variable data caching is a problem common to
Apache::ASP and modperl in general.  "use strict"
programming tends to help, as it requires explicit
variable initialization or declaration.

To do "use strict" for all your Apache::ASP scripts,
turn on the config:

   PerlSetVar UseStrict 1

This is documented at:
  http://www.apache-asp.org/config.html#UseStrict

This problem can also occur with the "my closure"
problem, documented in the mod_perl guide at:
  http://perl.apache.org/guide/perl.html#my_Scoped_Variable_in_Nested_S

To avoid this, I would highly recommend not declaring
subroutines in your ASP scripts, and have those subroutines
in your global.asa or normal perl library.  Apache::ASP
scripts are compiled as perl subroutines, so embeded
subroutines are prone to this behavior.

--Joshua

_________________________________________________________________
Joshua Chamas                           Chamas Enterprises Inc.
NodeWorks >> free web link monitoring   Huntington Beach, CA  USA
http://www.nodeworks.com                1-714-625-4051


"Demetrios C. Christopher" wrote:
>
> Hello and thanks in advance for any help.
>
> I am running Apache Stronghold 2.4.2 with modperl 1.21 and Apache::ASP
0.18
> (just recently upgraded to the latest - 2.03 I believe - but the problem
was
> intermittent so I wanted to still check with the forum).  Sure, pretty
much
> everything could use an update and within the next couple of months I plan
> to do so but this software resides on a production box so there's little
> room
> for mishaps. I am waiting to install all the newest software on a new box
> and
> then transfer control.
>
> So, as the subject line states, the variables in my .asp's tend to retain
> the
> values used in previous script runs.  If I leave stronghold going for a
> while
> without a restart, I can go to one of the forms, load it (initially
> everything
> should be blank) and then see someone else's info already filled out.  By
> the
> way, these forms that I wrote (eg. a registration form) are forms that
will
> initially print out the empty form and then upon submission do data
> validations
> and reprint the form (prefilling whatever passed the validation).  The
same
> script handles everything.  I'm sure I didn't invent this but I just
wanted
> to
> make sure everyone got the flow of the code.  No criticism please, this
code
> works great (prev. an IIS/ASP developer) and it's easy to maintain and
> duplicate.  ;)
>
> So, after my scripts take the info from the POST forms and place it into
> variables, these variables seem to retain the values instead of clean up
at
> the
> end of the script.  I use "my" throughout.  I simply cannot see why the
> variables
> would become global _and_ persistent.  I can't vouch for "global" I
guess...
> I
> think it's only within a certain server thread and not the entire server
> since
> subsequent refreshes may yield other sets of info as well and many
refreshes
> later you end up cycling through all sets.
>
> Again, I would appreaciate any and all help.
>
> Demetrios

Reply via email to