加载“模块”在 莫乔里西斯
需要帮助。需要实现“模块”的安装和加载。 “模块”插件位于 lib// 等文件中。我想我应该以某种方式在子目录 lib/ 中搜索“模块”,加载插件以检查它是否已安装,如果没有安装则安装它(例如,MyApp::MyModule->install())。该插件包含“模块”、帮助程序等。您有什么想法吗?
看起来像最终代码:
# 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;
}
Need for help. Necessary to implement the installation and loading of "modules". "Module" plug-in is located in the file like lib//. I think I should somehow take the search subdirectories lib/ for "module", load the plugin to check if it is installed, and install it if not (for example, MyApp::MyModule->install()). The plugin contains "module", helpers, etc. Does you have anything ideas?
seems like final code:
# 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;
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
模块::Pluggable
Module::Pluggable