Hi all,

I'm just starting to cut my teeth in mod_perl by pushing some scripts
into PerlRun and Registry.  Simple scripts work fine, exported subr() from
modules work fine, however under PerlRun, exported variables from modules
lose their value after the first run.  This appears similar to an old post

>FROM: Leslie Mikesell
>DATE: 01/18/1999 22:23:26
>SUBJECT: RE: mod_perl_1.17 and Apache_1.3.4 
>[imported subr() undefed after one run in PerlRun (1.17)]

The code is simple:
----------------------------------------------------------
#!/raid/townhall/bin/perl -w
use strict;
use lib qw(.);
use test2 qw($TEST runit);

print "\n";

print "TEST export: $TEST<BR>";
print "TEST direct: $test2::TEST<BR>";
print "RUN: ", runit(), "<BR>";

----------------------------------------------------------
package test2;
use strict;

BEGIN {
#       use vars qw($TEST);
        use Exporter ();
        @test2::ISA = qw(Exporter);
        @test2::EXPORT = qw();
        @test2::EXPORT_OK = qw($TEST &runit);
}
use vars qw($TEST);
$TEST = "in module";
sub runit { return "<HR>running $TEST and it<HR>"; }
1;
----------------------------------------------------------

Under Registry, everything is fine.  Under PerlRun, one execution is
fine and then $TEST is undef.  Subsequent Registry runs are then broken
too.  My conclusion is that PerlRun is undefining the cached package 
variable.  Is this an unavoidable side-effect of exporting into a namespace
that gets flushed?  A bug?  Can I be craftier in my exporting?

Apache 1.3.9  mod_perl 1.21  perl 5.005_03

-j

Reply via email to