Modperlers...

I was wondering what you all thought about clearing the Cv PAD between
uses.  It's not currently being done, and is sort of a security
concern otherwise.  Of course you can argue that no one should use
variables without initializing them, but people do frequently.

The reason I bring this up is I'm in the process of putting together a
modperl like program for phhttpd.  (Like it based on that it's
designed to run CGIs blazingly fast, pre-cached code, etc.  Pretrials
on highly trivial scripts show it's 3x faster than modperl, but that's
a lie, I think 100% of that gain is due to the efficient nature of
phhttpd as opposed to apache.  Phhttpd!=stable, BTW)

Well... if anyone is interested in the code for clearing the pad I'd
be happy to send it out, or if you'd like some sample code to "show
off" the problem I'd be happy to do so as well.

As an aside that's really not an aside:

There also appears to be a problem with fake lexicals disassociating.
(i.e. ones that on the PAD are denoted as "FAKE" because they are
"inherited" by a super-function)  For instance:

my %doggies;
doSomething();
print $doggies{"great dane"};
delete %doggies; #wouldn't have to do this with cv pad clearing :)
sub doSomething {
        $doggies{"great dane"}="big doggie";
}

This doesn't *always* print out "big doggie", although it seems as
though it should.  It will a few times, and then start blowing chunks.
(Note: didn't try this precise example, but a subset of it that had
other bugs which might have tainted the result)
Of course this example isn't a very good design either, I would do it
differently in production code, but it's just an example to show a
weakness.

The possible problem with PAD clearing is that it might slow down the
system, seems silly to slow the system down just to cover for sloppy
programming, right?  Well, I agree, this is probably true.  My idea on
this front is to see if it's possible to tie to these lexicals to a
hash that will denote whether a lexical has been modded in the course
of execution.  That hash will be checked after running the program and
delete all the appropriate SV's, AV's, HV's, etc.

Just wanted to get your opinion since you've all been down this road,
and suggest something that may be cool, or have zero merit :).

Shane.

Reply via email to