jshinb2g has asked for the wisdom of the Perl Monks concerning the following question:

I'm using Apache2::Reload and mod_perl2. It seems that when I have a module that has 'use base', it doesn't load the base Module. I can tell it's loading the touched module because all subroutines in that module gets 'redefined' but none from the base module. Hence when I go to use my reloaded module, some of the subroutines are undefined. Has anyone had problems with this and possibly a solution? Here is a simplified version of my code:
--
package Handler;

use Apache2::Reload;

sub handler {
    Admin::Test->new();
}
--
package Admin::Test;

use parent 'Admin::Base';

...
--
package Admin::Base:

sub new {
    my ( $class, $self, ) = @_;
    $self ||= {};
    return bless $self, $class;
}
--
When I restart apache, everything works as expected... Now when I change Admin::Test, I get the following error: Can't locate object method "new" via package "Admin::Test" at Handler.pm I don't think it's my code. Any help would be appreciated.

Replies are listed 'Best First'.
Re: apache2::reload and base.pm
by WizardOfUz (Friar) on Feb 17, 2010 at 08:20 UTC

    As an alternative approach, have you considered setting MaxRequestsPerChild to 1 in your httpd.conf?

      Hi Wizard, I haven't considered this... I would love to get the apache reload working if possible. But if I cannot, I might have to resort to this. Thanks.
        Did you find workaround? I have the same problem and nothing helps.
Re: apache2::reload and base.pm
by Anonymous Monk on Feb 17, 2010 at 05:32 UTC
    1) don't use base 2) try use parent
      getting same exact behavior... undefined subroutines.