我的項目結構:如何在perl中動態加載插件文件?
Test.pm
Plugins/Plugin1.pm
Plugins/Plugin2.pm
test.pm樣子:
sub new{
#how to dynamic load plugins?
plugin1,plugs2提供相同的API,比如說,sub run {#...}
perl腳本的樣子:
my $test=Test->new("Plugin1");
$test->run ;#should call Plugin1->run
那麼如何在test.pm中動態加載插件呢?
有沒有什麼好的框架可以幫助我?
謝謝。
http://stackoverflow.com/questions/2025261/how-can-i-find-all-the-packages-that-inherit-from-a-package-in-perl http://stackoverflow.com/問題/ 2478009/how-do-i-write-perl-object-with-plugins http://stackoverflow.com/questions/4815432/what-is-the-best-option-for-building-a-plugin-system -for-a-moose-application http://stackoverflow.com/questions/8301959/dynamically-loading-perl-modules – daxim 2012-01-09 14:56:08