Доброго всем

Mojolicious::Che

¡ ¡ ¡ ALL GLORY TO GLORIA ! ! !

VERSION

0.002

NAME

Mojolicious::Che - Мой базовый модуль для приложений Mojolicious. Нужен только развернутый конфиг.

SYNOPSIS

use Mojo::Base 'Mojolicious::Che';

sub startup {
  my $app = shift;
  $app->plugin(Config =>{file => 'Config.pm'});
  $app->che_go();
}
__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 => 'SESS'},
# Хуки
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();"
  },
},
routes => [
  [get=>'/', to=> {cb=>sub{shift->render(format=>'txt', text=>'Hello!');},}],
]
};

SEE ALSO

Mojolicious

Ado

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.