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
[ 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?
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
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,
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
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
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
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
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
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
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
11 matches
Mail list logo