Re: a new mod_perl problem

2005-10-19 Thread angel flower
Thanks a lot for your good explaining.I have been somewhat clear about it. I'll do more reading just as you said.:) Angel Flower From: Perrin Harkins <[EMAIL PROTECTED]> To: angel flower <[EMAIL PROTECTED]> CC: "modperl@perl.apache.org" Subject: Re: a new mod

Re: a new mod_perl problem

2005-10-19 Thread Perrin Harkins
[ Please keep your questions on the list. ] On Wed, 2005-10-19 at 12:39 +0800, angel flower wrote: > hi,perrin, > Can you tell me what meaning of this sentence: > > Making a sub that refers to a lexical variable declared outside of its > scope will ALWAYS create a closure. > > Why this happen?

Re: a new mod_perl problem

2005-10-18 Thread Perrin Harkins
angel flower wrote: > With mod_perl, each subroutine in every Apache::Registry script is > nested inside the handler subroutine. That's true, but it didn't contribute to your problem. What Stas was referring to in that writeup was a sub that is already nested before you run it under Apache::Regi

Re: [OT] Re: a new mod_perl problem

2005-10-18 Thread Foo Ji-Haw
hn ORourke" <[EMAIL PROTECTED]> To: "Perrin Harkins" <[EMAIL PROTECTED]> Cc: "angel flower" <[EMAIL PROTECTED]>; Sent: Tuesday, October 18, 2005 11:33 PM Subject: Re: [OT] Re: a new mod_perl problem > Perrin Harkins wrote: > > > > >Good guess,

RE: a new mod_perl problem

2005-10-18 Thread angel flower
vars with 'my' outside of nested subroutine,the problem happened.That's the reasons. Thanks for everyone answerer. Angel Flower From: "angel flower" <[EMAIL PROTECTED]> To: modperl@perl.apache.org Subject: a new mod_perl problem Date: Tue, 18 Oct 2005 17:38:17

Re: [OT] Re: a new mod_perl problem

2005-10-18 Thread John ORourke
Perrin Harkins wrote: Good guess, but that's not what is happening here. What our flowery friend has stumbled onto is a closure. When a subroutine references a "my" variable that was declared outside of that subroutine's scope, the sub will keep a private copy of that variable. If it wasn't

Re: [OT] Re: a new mod_perl problem

2005-10-18 Thread Perrin Harkins
On Tue, 2005-10-18 at 11:01 +0100, John ORourke wrote: > 'my' means that it is local to the main program, so your subroutine > won't see that version of "$counter". Your subroutine will create and > access a global version of "$counter" which is separate and doesn't get > re-initialised. Good gues

Re: [OT] Re: a new mod_perl problem

2005-10-18 Thread Geoffrey Young
angel flower wrote: > > Thanks.But I think your answer is not the one that I wanted. http://perl.apache.org/docs/1.0/guide/porting.html#Sometimes_it_Works__Sometimes_it_Doesn_t http://perl.apache.org/docs/general/perl_reference/perl_reference.html#myScoped_Variable_in_Nested_Subroutines HT

RE: [OT] Re: a new mod_perl problem

2005-10-18 Thread angel flower
Thanks.But I think your answer is not the one that I wanted. From: John ORourke <[EMAIL PROTECTED]> To: angel flower <[EMAIL PROTECTED]> CC: modperl@perl.apache.org Subject: [OT] Re: a new mod_perl problem Date: Tue, 18 Oct 2005 11:01:47 +0100 Angel Flower, 'my' mea

[OT] Re: a new mod_perl problem

2005-10-18 Thread John ORourke
Angel Flower, 'my' means that it is local to the main program, so your subroutine won't see that version of "$counter". Your subroutine will create and access a global version of "$counter" which is separate and doesn't get re-initialised. You need to read up on 'my' and references - do "man perl

a new mod_perl problem

2005-10-18 Thread angel flower
hi, I am new to mod_perl.This is my first doubt,and I need some help. I test this script under mod_perl: #!/usr/bin/perl -w use strict; use warnings; print "Content-type: text/plain\r\n\r\n"; my $counter = 0; # Explicit initialization technically redundant for (1..5) { incremen