Re: Apache::ASP : perl variables tend to stick ...

2000-09-21 Thread Joshua Chamas

"Demetrios C. Christopher" wrote:
 
 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 don't think I would be able to successfully parse out
subroutines without writing a complicated parser, but its
an interesting idea.  I could have the UseStrict setting
trigger an error_log warning recommending to move subs 
to a perl library possibly if I find a \nsub\s+\w+\s*{\s*\n 
kind of expression in the ASP perl code.

 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

The problem/benefit of mod_perl is that things persist so
variables don't get cleared, and my closures don't get 
recompiled.  Your array growing problem sounds like one
that "use strict" programming will take care of because
if you initialize your array with my @arr; then it should
be cleared just fine every script execution.

--Joshua



Apache::ASP : perl variables tend to stick ...

2000-09-20 Thread Demetrios C. Christopher

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




Re: Apache::ASP : perl variables tend to stick ...

2000-09-20 Thread Joshua Chamas



"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

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



Re: Apache::ASP : perl variables tend to stick ...

2000-09-20 Thread Joshua Chamas

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.com1-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



RE: Apache::ASP : perl variables tend to stick ...

2000-09-20 Thread Demetrios C. Christopher

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.com1-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
 t