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

NAME

Mojolicious::Plugin::DBIxCustom - 链接DBIx::Custom到Mojolicious的插件

SYNOPSIS

    # Mojolicious
    $self->plugin('DBIxCustom',{
        dsn=>"DBI:SQLite:dbname=:memory:",
        connector=>1,## 默认使用DBIx::Connector
        model_namespace=>"T::Model",
        dbi_class=>"T::MyDBIxCustom"
    });
 
    # Mojolicious::Lite
    plugin 'DBIxCustom',{
        dsn=>"DBI:SQLite:dbname=:memory:",
        connector=>1,## 默认使用DBIx::Connector
        model_namespace=>"T::Model",
        dbi_class=>"T::MyDBIxCustom"
    };

METHODS

Mojolicious::Plugin::DBIxCustom 覆盖了Mojolicious::Plugin中的register方法。

register

向Mojolicious中添加了两具helper:dbi和model。 其中dbi默认是一个DBIx::Custom对象,你也可以通过指定dbi_class来指定一个DBIx::Custom的子类,用来实例化为dbi。 名为model的helper是dbi中model方法的别名。

OPTION

这里的OPTION介绍的是register方法的参数支持的OPTION。

DBIx::Custom初始化参数

所有用于DBIx::Custom初始化参数都可以通过register的option来指定。 如:dsn、user、password、connector、option等。

dbi_class

dbi_class 默认为DBIx::Custom你也可以自己指定,但必须为DBIx::Custom的子类,它会被实例化得到dbi对象。

model_namespace

model_namespace是用于作为参数来调用dbi_class的include_model方法的。调用此方法时会自动加载对应命名空间下的所有model。

    $dbi->include_model($model_namespace);
    

如果没有给出此参数,则不会调用include_model方法。

AUTHOR

wfso, <461663376 at qq.com>

BUGS

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

You can also look for information at:

ACKNOWLEDGEMENTS