perl-asp mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Csongor Fagyal <>
Subject Re: RFC: subroutines & script recompilation
Date Wed, 12 Feb 2003 13:49:22 GMT
Josh Chamas wrote:

> Hi,
> I am interested in applying a fix to Apache::ASP that has some
> significant implications and would like to put this out for comment.
> The problem is that when subroutines are defined in a script,
> they create closure issues as discussed here:
> The greater problem is that resolving these closure issues can
> be a hair pulling event, and unless one gets into mod_perl
> and Apache::ASP significantly, this may be overlooked.  I would
> like Apache::ASP to be more newbie friendly.
> The solution is whenever a subroutine definition is detected as in:
> sub some_name {
> }
> that script will be compiled as normal, but the (re)compilation
> will be forced each script invocation.  The closure issues will
> go away because the subroutines will be redefined each script
> request.  The downside is that there will be a performance hit
> where there was none before. 

> Any advanced user should know not to put subs in scripts,
> so I am not worried about the performance hit to people that
> know what they are doing.  This in effect would create a
> penalty for those that do not follow the STYLE GUIDE. 

What about making this a default, and let the user configure if the 
"old" method is preferred or the new one? (If it is easy to do - 
otherwise I don't think anyone writes closures _intentionally_, so 
applying this patch would not hurt.)

> Because this fix will be functionally transparent, I do not
> think I should save it for 3.0 

> There is another associated fix, to recompile global.asa per
> request when XMLSubs are detected there, or subs defined
> in a package not their own, as in:
> sub package::some_sub {
> }
> which can also create closure issues.  I don't believe this is
> as frequent a problem for newbies though, so not as concerned
> about this and can save this fix for later sometime if necessary.
> Any comments?

This later one is less important IMHO.

Also, the problem is that closures themselves are somewhat hard to 
understand: I consider them as being the part of "advanced" perl 
programming. If you tell a Perl/ASP newbie not to use subs in ASP, the 
he will place it in an external file and "require" it. Too bad... 
Apache::ASP should be easy to use even for those who are not perl guru-s 
- Apache::ASP should be _the_ alternative for PHP. I think we all would 
welcome a modification like this, especially since sometimes people have 
to use pre-written scripts which break when unwanted closures appear.

- Cs.

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message