ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> perl5-porters
perl5-porters
Re: Ignorant wumpus? Or scoping problem?
by Glenn Linderman other posts by this author
Nov 28 2003 10:46PM messages near this date
Re: Ignorant wumpus? Or scoping problem? | Re: Ignorant wumpus? Or scoping problem?
On approximately 11/28/2003 1:40 PM, came the following characters from
the keyboard of Stas Bekman:

>  Glenn Linderman wrote:
>  [...]
>  
> > The terms "closure" and "nested scope" seem to have very pure 
> > definitions, but the current Perl implementation doesn't seem to be 
> > particularly pure with regards to evals.  So the description of how 
> > Perl works can use the terms "closure" and "nested scope" as a first 
> > approximation of how things work, but Dave description of how things 
> > actually work, which is somewhat more limited, is very necessary to 
> > understanding the current situation.
>  
>  In the mod_perl world users of Apache::Registry have to deal with 
>  closure problems quite often. Since most people aren't aware that what 
>  registry does is wrapping your cgi script into a 'sub handler { }' 
>  wrapper, turning any other sub foo {} in thec cgi script into a closure 
>  if it references any lexical variable defined on what used to be a top 
>  level of the cgi script. Therefore we have a special document dedicated 
>  to this kind of tricky Perl issues:
>  http://perl.apache.org/docs/general/perl_reference/perl_reference.html#my___Scoped_Variabl
e_in_Nested_Subroutines 
>  
>  http://perl.apache.org/docs/general/perl_reference/perl_reference.html#Understanding_Closu
res____the_Easy_Way 
>  
>  http://perl.apache.org/docs/general/perl_reference/perl_reference.html#When_You_Cannot_Get
_Rid_of_The_Inner_Subroutine 
>  
>  
>  I find the following section to be the most helpful to understanding 
>  closures:
>  http://perl.apache.org/docs/general/perl_reference/perl_reference.html#Understanding_Closu
res____the_Easy_Way 
>  
>  If I remember correctly it was Randal Schwartz who suggested this 
>  technique to tell closures from non-closures.

Thanks, Stas, more documentation is always better than less 
documentation, and that looks like a very nice explanation of some parts 
of Perl closures, and some issues when using Apache, which I haven't yet 
run into, but as my web host uses Apache, I may someday run into them... 
I'll have to read the whole document at some point -- in my cursor 
searches of Apache documentation thus far, I hadn't yet found that 
document.

The sections you mentioned don't address issues with mixing in eval 
STRING constructs, which seems to be the root of the discussion at hand, 
however.  I wonder if the Apache::Registry affects that issue at all, 
like the Perl debugger (prior to version 5.10) does.  I don't have the 
bandwidth or need to pursue that line of thought, at present.

-- 
Glenn -- http://nevcal.com/
===========================
Like almost everyone, I receive a lot of spam every day, much of it
offering to help me get out of debt or get rich quick.  It's ridiculous.
-- Bill Gates

And here is why it is ridiculous:
  The division that includes Windows posted an operating profit of $2.26 
  billion on revenue of $2.81 billion.
  --from Reuters via 
http://biz.yahoo.com/rc/031113/tech_microsoft_msn_1.html

So that's profit of over 400% of investment... with a bit more 
investment in Windows technology, particularly in the area of 
reliability, the profit percentage might go down, but so might the bugs 
and security problems?  Seems like it would be a reasonable tradeoff. 
WalMart earnings are 3.4% of investment.
Thread:
Glenn Linderman
Dave Mitchell
Stas Bekman
Brad Baxter
Stas Bekman
Dave Mitchell
Stas Bekman
Glenn Linderman
Dave Mitchell
Glenn Linderman
Dave Mitchell
Glenn Linderman
Brad Baxter
Brad Baxter
Glenn Linderman
Dave Mitchell
Rafael Garcia-Suarez
Glenn Linderman
Stas Bekman
Glenn Linderman
Alan Burlison

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved