The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Mojolicious::Services - Mojolicious::Services 是为Mojolicious框架提供的Service管理插件。

VERSION

Version 0.01

SYNOPSIS

    use Mojolicious::services
    my $service_manage = Mojolicious::services->new({
          dbi=>DBIx::Custom->new(),
          models=>{},
          namespaces=>s["Mojolicious::Service"],
          lazy => 1
      });
      
    ## fetch a service
    my $user_service = $service_manage->service("user");

DESCRIPTION

Mojolicious::services是为Mojolicious框架提供Service支持的模块。

ATTRIBUTES

Mojolicious::services 从 Mojolicious::Service中继承了所有属性,并实现以下属性。

services

存储service的属性。

namespaces

namespaces 用于说明service类所在的命名空间,这个属性的值是一个arrayref 类型的值,支持在多个命名空间中查找service。

lazy

用于说明是否启用懒加载模式。 如果值为true则启用懒加载,只有在实际请求一个service时才加载其类并实例化一个service对象。 如果为flase则在创建Mojolicious::services时加载所有service类并实例化成对象。

METHODS

Mojolicious::services 从 Mojolicious::Service中继承了所有方法,并实现以下方法。

load_service

根据service的名字加载service。

load_all_service

加载 namespaces 属性指定的所有命名空间下的所有service,并实例化。 注:只有在非懒加载模式的初始化阶段才会调用这个方法。

new

生成一个新的Mojolicious::services对象。

service

根据 service 的名称从 services 属性中获取 service。如果在 services 属性中不存在对应的键,则尝试从 namespaces 属性指定的命名空间中加载并实例化一个service。如果尝试加载后仍获取失败,则返回 undef。

AUTHOR

wfso, <461663376@qq.com>

BUGS

Please report any bugs or feature requests to bug-mojolicious-services at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Mojolicious-services. 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::services

You can also look for information at: