On Thu, May 25, 2000 at 11:58:38AM -0700, Doug MacEachern <[EMAIL PROTECTED]> wrote:
> > You must be kidding here!!! Using lexicals on package level is broken??? If
> > it is broken, then _why_ is it recommended programming practise in perl (see
> > perltoot for example)?
>
> i'm not kidding. i don't understand whay you mean by 'using lexicals on
> package level is broken'.
here is my module, in very terse pseudocode:
=============================================================================
package mymodule;
my some"globals";
sub functiousing someglobals {
}
now load other code (in some kind of xml) and compile it into it's
package, UNLESS the package already exists.
==========================================================================
And this obviously breaks for the newly compiled code. The caching,
unfortunately, is very important. Surely I could make an exception when
running under mod_perl with PerlFreshRestart, but that code runs nicely in
other environments, since the apache bits have been abstracted away. Read
below.
> and, like i said, i realize that certain modules make assumptions that
> they will only be loaded once in the same process and that re-parsing them
> can uncover subtle problems. but i still consider such assumptions to be
> broken.
Sorry, but reparsing is never done by perl itself (it explicitly says so),
so mod_perl clearly is not acting like perl.
So, in in the mod_perl dialect of perl, modules that work fine in perl
magically break on restarts. This is because mod_perl "restarts" by
fooling the perl interpreter to think it hasn't seen _some_ parts of the
program(s) and tries to reload all on top of it.
What's confusing here is the term "FreshRestart", which doesn't do
anything like a "fresh restart".
The reason this is important to me is not because I couldn't make an
exception to my code for apache - it's the real world, so hacks are
necessary in many cases anyway - but because what's broken is mod_perls
idea of "fresh restarting" by cheating the perl interpreter rather than my
code.
Now that I know what's going on it's not a big deal, but if you call
my code broken you should have rather good arguments on the basis of
the perl language and protgramming, not because mod_perl does some very
undocumented things differently to perl itself.
--
-----==- |
----==-- _ |
---==---(_)__ __ ____ __ Marc Lehmann +--
--==---/ / _ \/ // /\ \/ / [EMAIL PROTECTED] |e|
-=====/_/_//_/\_,_/ /_/\_\ XX11-RIPE --+
The choice of a GNU generation |
|