Доброго всем
Mojolicious::Che
¡ ¡ ¡ ALL GLORY TO GLORIA ! ! !
VERSION
0.003
NAME
Mojolicious::Che - Мой базовый модуль для приложений Mojolicious. Нужен только развернутый конфиг.
SYNOPSIS
use Mojo::Base 'Mojolicious::Che';
sub startup {
my $app = shift;
$app->plugin(Config =>{file => 'Config.pm'});
$app->поехали();
}
__PACKAGE__->new()->start();
Config file
{
'Проект'=>'Тест-проект',
# mojo => {
# mode=>...,
# log_level => ...,
# secrets => ...,
# plugins=> ...,
# session => ...,
# hooks => ...,
# has => ...,
# },
mojo_mode=> 'development',
mojo_log_level => 'debug',
mojo_plugins=>[
[charset => { charset => 'UTF-8' }, ],
#~ ['HeaderCondition'],
#~ ['ParamsArray'],
],
mojo_session => {cookie_name => 'ELK'},
# Хуки
mojo_hooks=>{
#~ before_dispatch => sub {1;},
},
# Хазы
mojo_has => {
foo => sub {my $app = shift; return 'bar!';},
},
mojo_secrets => ['true 123 my app',],
dbh=>{# will be as has!
'main' => {
# DBI->connect(dsn, user, passwd, $attrs)
connect => ["DBI:Pg:dbname=test;", "postgres", undef, {
ShowErrorStatement => 1,
AutoCommit => 1,
RaiseError => 1,
PrintError => 1,
pg_enable_utf8 => 1,
#mysql_enable_utf8 => 1,
#mysql_auto_reconnect=>1,
}],
# will do on connect
do => ['set datestyle to "ISO, DMY";',],
# prepared sth will be as has $app->sth->{<dbh name>}{<sth name>}
sth => {
foo => <<SQL,
select *
from foo
where
bar = ?;
SQL
},
}
},
# prepared sth will be as has $app->sth->{<dbh name>}{<sth name>}
sth => {
main => {
now => "select now();"
},
},
namespaces => [],
routes => [
[get=>'/', to=> {cb=>sub{shift->render(format=>'txt', text=>'Hello!');},}],
]
};
METHODS
Mojolicious::Che inherits all methods from Mojolicious and implements the following new ones.
поехали
Top-level method. Setup the secrets, mode, log level from app->config(). Then invoke all other metods below.
хазы
Has
базы
DBI handlers
запросы
DBI statements
плугины
Plugins
хуки
Hooks
сессия
Session
спейсы
Namespases
маршруты
Routes
SEE ALSO
AUTHOR
Михаил Че (Mikhail Che), <mche[-at-]cpan.org>
BUGS / CONTRIBUTING
Please report any bugs or feature requests at https://github.com/mche/Mojolicious-Che/issues. Pull requests also welcome.
COPYRIGHT
Copyright 2016 Mikhail Che.
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.