NAME
Mojolicious::Plugin::Service - 向Mojolicious框架中引入Service管理器的插件!
DESCRIPTION
向Mojolicious框架中引入Service管理器的插件。
SYNOPSIS
# Mojolicious
$app->plugin('Service',$config);
# Mojolicious::Lite
plugin('DefaultHelpers',$config);
METHODS
Mojolicious::Plugin::Service inherits all methods from Mojolicious::Plugin and implements the following new ones.
register
$plugin->register(Mojolicious->new,$config);
Register helper in Mojolicious application named service.
config Option
register 方法中除接受Mojolicious对象为参数外,还接受一个config参数。这个config参数是必须是一个hashref。
{
dbi=>DBIx::Custom->new(),
models=>DBIx::Custom->new->models,
namespaces=>s["Mojolicious::Service"],
lazy => 1
}
dbi
dbi 是为service提供数据库操作接口的对象。
models
models 是为service提供数据模型操作接口的对象。
namespace
namespace 用于说明service类所在的命名空间,这个属性的值是一个arrayref 类型的值,支持在多个命名空间中查找service。
lazy
用于说明是否启用懒加载模式。 如果值为true则启用懒加载,只有在实际请求一个service时才加载其类并实例化一个service对象。 如果为flase则在创建Mojolicious::ServiceManage时加载所有service类并实例化成对象。
AUTHOR
wfso, <461663376@qq.com>
BUGS
Please report any bugs or feature requests to bug-mojolicious-servicemanage at rt.cpan.org
, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Mojolicious-ServiceManage. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
SUPPORT
You can find documentation for this module with the perldoc command.
perldoc Mojolicious::Plugin::Service
You can also look for information at:
RT: CPAN's request tracker (report bugs here)
http://rt.cpan.org/NoAuth/Bugs.html?Dist=Mojolicious-ServiceManage
AnnoCPAN: Annotated CPAN documentation
CPAN Ratings
Search CPAN
1 POD Error
The following errors were encountered while parsing the POD:
- Around line 40:
Non-ASCII character seen before =encoding in '向Mojolicious框架中引入Service管理器的插件!'. Assuming UTF-8