perl-asp mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Josh Chamas <>
Subject RFC: subroutines & script recompilation
Date Tue, 11 Feb 2003 21:11:44 GMT

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.

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?



Josh Chamas, Founder                   phone:925-552-0128
Chamas Enterprises Inc.      
NodeWorks Link Checking      

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

View raw message