Re: PerlRun and Exporter() vars
On Mon, 27 Dec 1999, John M Vinopal wrote: More about the undef of package variables. Sure enough, the variables are nuked in PerlRun::flush_namespace(). This can be inhibited by removing them from the script's namespace before termination: my $name = __PACKAGE__ . '::'; delete($name-{'VARIABLE NAME HERE'}); I notice that the 1.17 bug about undefing subroutines was fixed by adding some checking code PerlRun::undef_cv_if_owner(), should this same sort of thing be done for variables as well? yes, sounds like that's the case. thanks for the insights. ToDo
Re: PerlRun and Exporter() vars
exported variables from modules lose their value after the first run. This appears similar to an old post package test2; [...] BEGIN { # use vars qw($TEST); use Exporter (); @test2::ISA = qw(Exporter); @test2::EXPORT = qw(); @test2::EXPORT_OK = qw($TEST runit); } [...] Under mod_perl, BEGIN blocks only get executed once per child. Therefore, the variables are only exported in the first run. Just move the content of the BEGIN block outside of the block as follows: package test2; [...] # use vars qw($TEST); use Exporter (); @test2::ISA = qw(Exporter); @test2::EXPORT = qw(); @test2::EXPORT_OK = qw($TEST runit); [...] or: package test2; [...] { # use vars qw($TEST); use Exporter (); @test2::ISA = qw(Exporter); @test2::EXPORT = qw(); @test2::EXPORT_OK = qw($TEST runit); } [...] Is this [...] A bug? no. This problem is not related to PerlRun or the flushing of the name space; the problem would also occur if one tried to use the module from two different scipts/modules (in the same child). ELB -- Eric L. Brine | Chicken: The egg's way of making more eggs. [EMAIL PROTECTED] | Do you always hit the nail on the thumb? ICQ# 4629314 | An optimist thinks thorn bushes have roses.
Re: PerlRun and Exporter() vars
exported variables from modules lose their value after the first run. This appears similar to an old post package test2; [...] BEGIN { # use vars qw($TEST); use Exporter (); @test2::ISA = qw(Exporter); @test2::EXPORT = qw(); @test2::EXPORT_OK = qw($TEST runit); } [...] Under mod_perl, BEGIN blocks only get executed once per child. Therefore, the variables are only exported in the first run. Just move the content of the BEGIN block outside of the block as follows: I think this statement is not absolutely correct. Saying "under mod_perl" is too general, since BEGIN/END blocks are used differently with registry scripts vs non-registry, so if you are talking about PerlRun -- BEGIN blocks are reevaluated on every invocation. See: http://perl.apache.org/guide/porting.html#BEGIN_blocks http://perl.apache.org/guide/porting.html#END_blocks Is this [...] A bug? no. This problem is not related to PerlRun or the flushing of the name space; the problem would also occur if one tried to use the module from two different scipts/modules (in the same child). Truth, see: http://perl.apache.org/guide/porting.html#Name_collisions_with_Modules_and ___ Stas Bekmanmailto:[EMAIL PROTECTED] http://www.stason.org/stas Perl,CGI,Apache,Linux,Web,Java,PC http://www.stason.org/stas/TULARC perl.apache.orgmodperl.sourcegarden.org perlmonth.comperl.org single o- + single o-+ = singlesheavenhttp://www.singlesheaven.com