> I know this topic has been discussed to death, but I think I can add
> something new.  :-)
> 
> Upon using Apache::RegistryLoader, I noticed my error logs started
> filling up with the dreaded "subroutine redefined" error.  These errors
> occur at the moment my scripts scripts are preloaded using
> Apache::RegistryLoader.
> 
> I put together a minimalistic example to demonstrate the problem.
> Consider the following module where function "foo" is exported by
> default and "bar" is exported on request.

I couldn't reproduce the warns you are talking about. I think your
Apache::RegistryLoader just didn't load the file... Try the latest version
from cvs (I've modified it to provide a better diagnostics on failure to
preload). Try it first...

I'm Apache/1.3.10-dev (Unix) mod_perl/1.21_01-dev (linux/perl5.005_03)

> 
> ###############################
> 
> package Foo;
> 
> use strict;
> use vars qw(@ISA @EXPORT @EXPORT_OK);
> use Exporter ();
> 
> @ISA = ('Exporter');
> @EXPORT = qw(foo);
> @EXPORT_OK = qw(bar);
> 
> sub foo {
>   return "foo";
> }
> 
> sub bar {
>   return "bar";
> }
> 
> 1;
> 
> ###############################
> 
> And consider the following script served by Apache::Registry:
> 
> ###############################
> 
> #!/usr/bin/perl -w
> 
> use strict;
> use CGI ();
> use Foo ();  # works okay, no error
> #use Foo;  # causes "Subroutine foo redefined..." error
> #use Foo qw(bar);  # causes "Subroutine bar redefined..." error
> #use Foo qw(:DEFAULT bar);  # causes errors for both foo and bar
> 
> my $q = CGI->new();
> print $q->header();
> print "Hello World\n";
> 
> ###############################
> 
> I tried the above script while "use"-ing Foo using the above techniques
> (stopping and starting the server each time to retest
> Apache::RegistryLoader.)  Upon each server start, RegistryLoader kicked
> out the error(s) shown commented above.  So it seems to be the import
> process causing the error.
> 
> In all cases, the Apache::Registry script works fine.  The error only
> appears when the script is preloaded using Apache::RegistryLoader -- I
> can suppress the error by not using RegistryLoader.
> 
> So what's causing the error?  Why is the subroutine being redefined?
> 
> Thanks,
> Matt
> 
> apache 1.3.6
> mod_perl 1.21
> perl 5.00503
> Apache::Registry 2.01
> Apache::RegistryLoader 1.90
> 
> 



_______________________________________________________________________
Stas Bekman  mailto:[EMAIL PROTECTED]    www.singlesheaven.com/stas  
Perl,CGI,Apache,Linux,Web,Java,PC at  www.singlesheaven.com/stas/TULARC
www.apache.org  & www.perl.com  == www.modperl.com  ||  perl.apache.org
single o-> + single o-+ = singlesheaven    http://www.singlesheaven.com

Reply via email to