2011-01-27 123 views
0

需要幫助。必須實施「模塊」的安裝和加載。 「模塊」插件位於像lib /這樣的文件中。我認爲我應該以某種方式將搜索子目錄lib/for「module」,加載插件以檢查它是否已安裝,如果不安裝(例如,MyApp :: MyModule-> install()),則安裝它。該插件包含「模塊」,助手等。你有什麼想法?在Mojolicious中加載「模塊」

似乎是最終代碼:

# Load Core 
my $_core = $self->plugin('FW::Core'); 

# Load modules 
my $plugins = FW::Core::Model::Module->select->hashes(); 
if(@$plugins) { 
    $self->plugin('FW::' . ucfirst $_->{name}) for @$plugins; 
} 

回答