[EMAIL PROTECTED] (Marc Lehmann) wrote:
>=============================================================================
>package othermodule;
>
>my $global = 5;
>
>sub set_global {
>   $global = shift;
>}
>=============================================================================
>
>And use this from another module:
>
>=============================================================================
>othermodule::set_global 7;
>=============================================================================
>
>Then, to my surprise, _sometimes_ the $global will be set, and sometimes not.

You know, if I didn't know any better, I'd say that you're simply setting
$global (not the best name) in one httpd child, but of course it's not getting
set in the others.


>The reason for this seems to be that othermodule is parsed twice: Once
>during configuration parsing and once later. The first time it is parsed,
>$global is created and bound to ste_global. Other modules that call the
>function get a reference to it cimpiled in.
>
>Then, when the file is parsed again, _another_ instance of $global gets
>created, and another instance of set_global is compiled. Now there are two
>versions of set_global, two versions of $global, and which one gets called
>very much depends on random factors.

I don't think I believe that.  Nothing gets parsed twice except http
configuration files.  Is this file used inside <perl> sections of config
files, maybe?


  -------------------                            -------------------
  Ken Williams                             Last Bastion of Euclidity
  [EMAIL PROTECTED]                            The Math Forum


Reply via email to