Hello,

I have an quite outdated perl-app, that does not work any more.
It consists of various objects and a simple plugin-interface. All "static"
objects work well, even with function overloading.

The plugin-objects do not work as expected any more.
I hope, someone can shine me a light ...

The plugins have a base-class, where the new() subroutine and common
initialization stuff resides.
All plugins belong to a subpackage of the base-class.
The app determines the name of the plugin from the filesystem.
The loading of the plugin happens like this:

if (opendir($dp, $base)) {
   while (my $de = readdir($dp)) {
      if ($de =~ /\.pm$/) {
         my $moduleName = 'subpkg::'.$de;

         eval "require $moduleName";

         if ($moduleName->isa('subpkg::Plugin')) {
            $inst = $moduleName->new($someArg);
         }
      }
   }
   closedir($dp);
}

I also tried to create the instance with:

 $inst = eval('new '.$moduleName);

but it makes no difference.
The new() - subroutine from the baseclass contains this print-statement:
   print($class.'::new() ... overloading does not work?!?'."\n");

and calls $self->init() afterwards.
Each init() - subroutine has a print-statement telling the classname and the
base-class as well as every plugin-class has the init() - subroutine.

From the output I can see, that the right plugin get's loaded, but the wrong
initialization happens (only the init() from the base class is executed).

The same code worked with perl 5.8.8 some months ago and I have no idea, what
part of perl changed and what I have to change in my scripts to get them 
working again.

Any help is very appreciated.

regards Reinhard

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to