Question
looping through classes using require
I have a number of plugin classes each of which have a method 'enable'. The following code works
unit class Top;
has $!rdp;
use Plugin::A;
use Plugin::B;
use Plugin::C;
submethod TWEAK {
my $rdp := self.rdp;
Plugin::A.new.enable($rdp);
Plugin::B.new.enable($rdp);
Plugin::C.new.enable($rdp);
}
The Plugin...
classes are only used once to prepare $rdp
, so I thought it would not matter whether the classes are looked up at run time or compile time.
I would like something of the form
for <A B C> {
require ::("Plugin::$_");
::("Plugin::$_").new.enable($rdp)
}
I tried a variety of syntaxes, none of which work.
What would be a way to do this?